no message

This commit is contained in:
Bright 2025-09-29 17:33:22 +07:00
parent e63799eb00
commit 5be3635198

View file

@ -160,6 +160,8 @@ export class CommandController extends Controller {
@Get("list")
async GetResult(
@Request() request: RequestWithUser,
@Query("sortBy") sortBy?: string,
@Query("descending") descending?: boolean,
@Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10,
@Query() keyword: string = "",
@ -262,14 +264,9 @@ export class CommandController extends Controller {
yearKeyword = match[1].trim();
}
let yearInBC = yearKeyword ? parseInt(yearKeyword) - 543 : null;
//
// console.log("k>>",keyword);
// console.log("bk>>",baseKeyword);
// console.log("yk>>",yearKeyword);
// console.log("yi>>",yearInBC);
const [commands, total] = await this.commandRepository
// const [commands, total] = await this.commandRepository
let query = await this.commandRepository
.createQueryBuilder("command")
.leftJoinAndSelect("command.commandType", "commandType")
.andWhere(
@ -339,6 +336,15 @@ export class CommandController extends Controller {
}),
)
.orderBy("command.createdAt", "DESC")
if (sortBy) {
query = query.orderBy(
`command.${sortBy}`,
descending ? "DESC" : "ASC"
);
}
let [commands, total] = await query
.skip((page - 1) * pageSize)
.take(pageSize)
.getManyAndCount();