Skip to content

Commit 3ee328f

Browse files
add prize service
1 parent 34b84a2 commit 3ee328f

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/domain/Prize.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { Query, QueryBuilder } from "@topcoder-framework/client-relational";
1+
import { Query, QueryBuilder, Operator } from "@topcoder-framework/client-relational";
22
import { CreateResult, ScanRequest, UpdateResult } from "@topcoder-framework/lib-common";
33
import { Util } from "../common/Util";
44
import { queryRunner } from "../helper/QueryRunner";
55
import {
66
CreatePrizeInput,
7+
DeletePrizeInput,
78
Prize,
89
PrizeList,
910
UpdatePrizeInput,
@@ -67,6 +68,26 @@ class PrizeDomain {
6768
updatedCount: affectedRows!,
6869
};
6970
}
71+
72+
public async delete(input: DeletePrizeInput) {
73+
await queryRunner.run(
74+
new QueryBuilder(PrizeSchema)
75+
.delete()
76+
.where(PrizeSchema.columns.projectId, Operator.OPERATOR_EQUAL, {
77+
value: {
78+
$case: "intValue",
79+
intValue: input.projectId,
80+
},
81+
})
82+
.andWhere(PrizeSchema.columns.prizeId, Operator.OPERATOR_EQUAL, {
83+
value: {
84+
$case: "intValue",
85+
intValue: input.prizeId,
86+
},
87+
})
88+
.build()
89+
);
90+
}
7091
}
7192

7293
export default new PrizeDomain();

0 commit comments

Comments
 (0)