-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
108 lines (95 loc) · 2.1 KB
/
types.ts
File metadata and controls
108 lines (95 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
export enum Difficulty {
Easy = 'Easy',
Medium = 'Medium',
Hard = 'Hard'
}
export enum TopicId {
Basics = 'basics',
Filtering = 'filtering',
Sorting = 'sorting',
Functions = 'functions',
Dates = 'dates',
Joins = 'joins',
Aggregation = 'aggregation',
Case = 'case',
Advanced = 'advanced'
}
export enum Page {
Landing = 'landing',
Home = 'home',
SqlGym = 'sql_gym',
DataLab = 'data_lab',
PythonGym = 'python_gym',
AngularGym = 'angular_gym',
Analytics = 'analytics',
Account = 'account',
ResetPassword = 'reset_password'
}
export enum PracticeMode {
Solve = 'solve', // Standard problem solving
Type = 'type' // Copy code / Typing Dojo
}
export interface TableColumn {
name: string;
type: string;
isPrimaryKey?: boolean;
isForeignKey?: boolean;
}
export interface TableSchema {
tableName: string;
columns: TableColumn[];
}
export interface Exercise {
id: string;
topicId: TopicId;
difficulty: Difficulty;
title: string;
description: string;
initialQuery: string;
solutionQuery: string;
brokenCode?: string; // For Debug Mode: query with intentional error
debugHint?: string; // For Debug Mode: hint about the error
hints: string[];
explanation: string;
}
export interface Topic {
id: TopicId;
label: string;
subtitle?: string; // SQL Keywords like SELECT, WHERE...
description?: string;
icon?: any;
}
export interface QueryResult {
success: boolean;
data?: any[];
error?: string;
message?: string;
}
export interface ValidationResult {
isCorrect: boolean;
userRowCount: number;
expectedRowCount: number;
message: string;
warningLevel?: 'none' | 'yellow';
warningMessage?: string;
}
export interface DiffResult {
missingRows: any[];
extraRows: any[];
differentCells: { rowIndex: number; column: string }[];
hasExtraColumns?: boolean;
extraColumns?: string[];
}
export interface ChartConfig {
type: 'bar' | 'pie' | 'kpi' | 'none';
xKey: string;
yKey: string;
}
export interface CsvData {
tableName: string;
fileName: string;
headers: string[];
rows: any[][];
rowCount: number;
rawBuffer?: ArrayBuffer;
}