Merge branch 'develop'

This commit is contained in:
Warunee Tamkoo 2025-09-19 17:15:54 +07:00
commit c6bc8fcd4b

View file

@ -269,10 +269,12 @@ export class EvaluationController {
pageSize: number;
keyword?: string;
status?: string[];
sortBy?: string,
descending?: boolean,
},
) {
try {
const [evaluation, total] = await AppDataSource.getRepository(Evaluation)
let query = await AppDataSource.getRepository(Evaluation)
.createQueryBuilder("evaluation")
.andWhere(
new Brackets((qb) => {
@ -293,6 +295,15 @@ export class EvaluationController {
}),
)
.orderBy("evaluation.lastUpdatedAt", "DESC")
if (body.sortBy) {
query = query.orderBy(
`evaluation.${body.sortBy}`,
body.descending ? "DESC" : "ASC"
);
}
const [evaluation, total] = await query
.skip((body.page - 1) * body.pageSize)
.take(body.pageSize)
.getManyAndCount();