Skip to content

Commit f8415fa

Browse files
committed
add types
1 parent 2f7f15a commit f8415fa

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

src/types/request.d.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export interface Request {
2+
source: string, // Base64 encoded
3+
lang: string,
4+
mode?: string, // default sync
5+
timlimit?: number, // default 5
6+
callback?: string // default null
7+
}
8+
9+
export interface RunRequest extends Request {
10+
stdin: string
11+
}
12+
13+
export interface Testcase {
14+
id: number,
15+
input: string,
16+
output: string
17+
}
18+
19+
export interface SubmitRequest extends Request {
20+
testcases: Array<Testcase>
21+
}

src/types/result.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface Testcase {
2+
id: number,
3+
score: number,
4+
time: string,
5+
result: string
6+
}

src/types/submission.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Testcase } from "./result";
2+
3+
export type SubmissionAttributes = {
4+
id: number,
5+
lang: string,
6+
start_time: Date,
7+
end_time?: Date,
8+
mode: string,
9+
callback?: string,
10+
results?: Array<Testcase>
11+
outputs?: Array<string>
12+
}

0 commit comments

Comments
 (0)