This commit is contained in:
Dominic Ferrando
2026-09-26 18:27:33 -04:00
parent b66980c0fb
commit 930bd61e62
4 changed files with 87 additions and 81 deletions
+4 -3
View File
@@ -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> {
+3 -3
View File
@@ -14,7 +14,7 @@ export const VerificationStatusSchema = t.Union([
]);
export type VerificationStatus = Static<typeof VerificationStatusSchema>;
export const REQUIRED_MEDIA_ACTIVITIES = Object.values(Activity);
const REQUIRED_MEDIA_ACTIVITIES = Object.values(Activity);
const MEDIA_KEY_COLUMN = {
[Activity.BackSquat]: "media_key_back_squat",
@@ -80,9 +80,10 @@ export class VerificationsService {
.executeTakeFirst();
}
async get(id: string) {
async get(id: string, accountId?: string) {
return await VerificationsService.baseQuery()
.where("verifications.id", "=", id)
.$if(accountId !== undefined, (qb) => qb.where("assessments.account_id", "=", accountId!))
.executeTakeFirst();
}
@@ -173,7 +174,6 @@ export class VerificationsService {
"verifications.verf_broad_jump",
"verifications.verf_run",
"verifications.verf_cone_drill",
"assessments.account_id",
"assessments.name",
"assessments.gender",
"assessments.age",