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")
.andWhere(
new Brackets((qb) => {
qb.andWhere(
if (
body.status == undefined ||
body.status == null ||
body.status.every((s) => s === "ALL")
? "1=1"
: `evaluation.step In (:status)`,
{
body.status == null ||
body.status.every((s) => s === "ALL")
) {
qb.andWhere("1=1");
} else {
qb.andWhere("evaluation.step IN (:...status)", {
status: body.status,
},
).andWhere("evaluation.createdUserId = :createdUserId", {
});
}
qb.andWhere("evaluation.createdUserId = :createdUserId", {
createdUserId: request.user.sub,
});
}),
@ -919,13 +921,15 @@ export class EvaluationController {
],
});
if (!evaluation) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
return new HttpSuccess(evaluation);
} catch (error: any) {
if (error instanceof HttpError) {
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;
@Column()
subject?: string | null;
subject?: string[] | null;
@Column()
commanderFullname?: string | null;