Skip to content

Commit a368d79

Browse files
feat: submission.update, reviewSummation
1 parent 93f01b0 commit a368d79

18 files changed

+2057
-242
lines changed

src/domain/LegacySubmission.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import { Operator, QueryBuilder } from "@topcoder-framework/client-relational";
1+
import { Operator, Query, QueryBuilder } from "@topcoder-framework/client-relational";
2+
import { UpdateResult, Value } from "@topcoder-framework/lib-common";
3+
import { Util } from "../common/Util";
24
import { queryRunner } from "../helper/QueryRunner";
35
import {
4-
CreateSubmissionInput,
6+
CreateSubmissionInput, UpdateSubmissionInput,
57
} from "../models/domain-layer/legacy/submission";
68
import { ProjectSchema } from "../schema/project/Project";
9+
import { LegacySubmissionSchema } from "../schema/submission/Submission";
710

811
class LegacySubmissionDomain {
912
public async checkSubmissionExists(
@@ -93,6 +96,18 @@ class LegacySubmissionDomain {
9396
// };
9497
// return Promise.resolve(10);
9598
// }
99+
100+
public async update(input: UpdateSubmissionInput): Promise<UpdateResult> {
101+
const query: Query = new QueryBuilder(LegacySubmissionSchema)
102+
.update({ ...input })
103+
.where(...Util.toScanCriteria({ ...input } as { [key: string]: number|string|undefined }))
104+
.build();
105+
106+
const { affectedRows } = await queryRunner.run(query);
107+
return {
108+
updatedCount: affectedRows || 0,
109+
}
110+
}
96111
}
97112

98113
export default new LegacySubmissionDomain();

src/domain/LegacyUpload.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Query, QueryBuilder } from "@topcoder-framework/client-relational";
2+
import { UpdateResult } from "@topcoder-framework/lib-common";
3+
import { Util } from "../common/Util";
4+
import { queryRunner } from "../helper/QueryRunner";
5+
import {
6+
UpdateUploadInput,
7+
} from "../models/domain-layer/legacy/upload";
8+
import { UploadSchema } from "../schema/submission/Upload";
9+
10+
class LegacySubmissionDomain {
11+
public async update(input: UpdateUploadInput): Promise<UpdateResult> {
12+
const query: Query = new QueryBuilder(UploadSchema)
13+
.update({ ...input })
14+
.where(...Util.toScanCriteria({ ...input } as { [key: string]: number|string|undefined }))
15+
.build();
16+
17+
const { affectedRows } = await queryRunner.run(query);
18+
return {
19+
updatedCount: affectedRows || 0,
20+
}
21+
}
22+
}
23+
24+
export default new LegacySubmissionDomain();

0 commit comments

Comments
 (0)