Cleanup
This commit is contained in:
@@ -24,10 +24,11 @@ export class AssessmentsService {
|
||||
.executeTakeFirstOrThrow();
|
||||
}
|
||||
|
||||
async get(id: string) {
|
||||
async get(id: string, accountId?: string) {
|
||||
return await db.selectFrom("assessments")
|
||||
.selectAll()
|
||||
.where("id", "=", id)
|
||||
.$if(accountId !== undefined, (qb) => qb.where("account_id", "=", accountId!))
|
||||
.executeTakeFirst();
|
||||
}
|
||||
|
||||
@@ -48,7 +49,7 @@ export class AssessmentsService {
|
||||
}
|
||||
|
||||
async update(id: string, player: Player, activityPerformances: ActivityPerformance[]) {
|
||||
const result = await db.updateTable("assessments")
|
||||
return await db.updateTable("assessments")
|
||||
.where("id", "=", id)
|
||||
.set({
|
||||
name: player.name ?? "Anonymous",
|
||||
@@ -62,8 +63,8 @@ export class AssessmentsService {
|
||||
perf_run: AssessmentsService.performanceFor(activityPerformances, Activity.Run),
|
||||
perf_cone_drill: AssessmentsService.performanceFor(activityPerformances, Activity.ConeDrill),
|
||||
})
|
||||
.returning("id")
|
||||
.executeTakeFirst();
|
||||
return result.numUpdatedRows > 0n;
|
||||
}
|
||||
|
||||
async delete(id: string, accountId: string): Promise<boolean> {
|
||||
|
||||
Reference in New Issue
Block a user