-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransformer.ts
More file actions
65 lines (57 loc) · 1.61 KB
/
Transformer.ts
File metadata and controls
65 lines (57 loc) · 1.61 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
import { Challenge, Evaluation, Format } from "./Challenge";
import { Participant } from "./Participant";
import { Submission } from "./Submission";
import { Judge } from "./Judge";
export abstract class Transformer {
public static newChallenge(payload: any): Challenge {
throw new Error("Method not implemented.");
}
public static validateChallengeMetadata(payload: any): boolean {
throw new Error("Method not implemented.");
}
public static newSubmission(
payload: any,
challenge: Challenge,
participant: Participant,
): Submission {
throw new Error("Method not implemented.");
}
public static validateSubmissionMetadata(payload: any): boolean {
throw new Error("Method not implemented.");
}
}
export class BaseTransformer extends Transformer {
public static newChallenge(payload: any) {
const challenge = new Challenge({
id: payload.id,
uuid: payload.uuid,
title: payload.title,
body: payload.body,
format: Format.TEXT,
points: payload.points,
evaluation: Evaluation.MANUAL,
deleted: payload.deleted,
});
return challenge;
}
public static validateChallengeMetadata(payload: any): boolean {
return true;
}
public static newSubmission(
payload: any,
challenge: Challenge,
participant: Participant,
): Submission {
const submission = new Submission({
id: payload.id,
uuid: payload.uuid,
challenge: challenge,
participant: participant,
assignee: null,
});
return submission;
}
public static validateSubmissionMetadata(payload: any): boolean {
return true;
}
}