no message

This commit is contained in:
Kittapath 2024-03-15 10:15:10 +07:00
parent 2529d7d43f
commit eeede05a30

View file

@ -1348,8 +1348,12 @@ export class SalaryPeriodController extends Controller {
* *
*/ */
@Get("active") @Get("active")
async GetListsSalaryPeriodActive() { async GetListsSalaryPeriodActive(
const salaryPeriod = await AppDataSource.getRepository(SalaryPeriod) @Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10,
@Query("keyword") keyword?: string,
) {
const [salaryPeriod, total] = await AppDataSource.getRepository(SalaryPeriod)
.createQueryBuilder("salaryPeriod") .createQueryBuilder("salaryPeriod")
.where({ isActive: true }) .where({ isActive: true })
.select([ .select([
@ -1363,9 +1367,11 @@ export class SalaryPeriodController extends Controller {
"salaryPeriod.revisionId", "salaryPeriod.revisionId",
]) ])
.orderBy("salaryPeriod.effectiveDate", "DESC") .orderBy("salaryPeriod.effectiveDate", "DESC")
.getMany(); .skip((page - 1) * pageSize)
.take(pageSize)
.getManyAndCount();
return new HttpSuccess(salaryPeriod); return new HttpSuccess({ data: salaryPeriod, total });
} }
/** /**