Merge branch 'develop'

This commit is contained in:
moss 2025-05-27 17:15:12 +07:00
commit 396a17c28e
2 changed files with 15 additions and 11 deletions

View file

@ -254,16 +254,18 @@ export class EvaluationController {
.createQueryBuilder("evaluation") .createQueryBuilder("evaluation")
.andWhere( .andWhere(
new Brackets((qb) => { new Brackets((qb) => {
qb.andWhere( if (
body.status == undefined || body.status == undefined ||
body.status == null || body.status == null ||
body.status.every((s) => s === "ALL") body.status.every((s) => s === "ALL")
? "1=1" ) {
: `evaluation.step In (:status)`, qb.andWhere("1=1");
{ } else {
qb.andWhere("evaluation.step IN (:...status)", {
status: body.status, status: body.status,
}, });
).andWhere("evaluation.createdUserId = :createdUserId", { }
qb.andWhere("evaluation.createdUserId = :createdUserId", {
createdUserId: request.user.sub, createdUserId: request.user.sub,
}); });
}), }),
@ -919,13 +921,15 @@ export class EvaluationController {
], ],
}); });
if (!evaluation) { if (!evaluation) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found."); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
} }
return new HttpSuccess(evaluation); return new HttpSuccess(evaluation);
} catch (error: any) { } catch (error: any) {
if (error instanceof HttpError) { if (error instanceof HttpError) {
throw error; throw error;
} else throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error); }
console.error("Unexpected error:", error);
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถดําเนินการได้");
} }
} }

View file

@ -596,7 +596,7 @@ export class CreateEvaluationExpertise {
author?: string | null; author?: string | null;
@Column() @Column()
subject?: string | null; subject?: string[] | null;
@Column() @Column()
commanderFullname?: string | null; commanderFullname?: string | null;