idz: Add SqlTimeAttackRepository

This commit is contained in:
Tau
2019-11-06 17:28:30 -05:00
parent 561f06eccb
commit ceaeebc0b4
7 changed files with 115 additions and 35 deletions
+1 -9
View File
@@ -6,15 +6,7 @@ export async function saveTimeAttack(
w: Repositories,
req: SaveTimeAttackRequest
): Promise<SaveTimeAttackResponse> {
if (req.payload.totalMsec > 0) {
const existing = await w
.timeAttack()
.load(req.profileId, req.payload.courseId);
if (existing === undefined || existing.totalMsec > req.payload.totalMsec) {
await w.timeAttack().save(req.profileId, req.payload);
}
}
await w.timeAttack().save(req.profileId, req.payload);
return {
type: "save_time_attack_res",