From 825263c11cdd0f15bf13059efb533b601d076fdd Mon Sep 17 00:00:00 2001 From: harid Date: Thu, 4 Jun 2026 17:40:36 +0700 Subject: [PATCH] =?UTF-8?q?API=20=E0=B8=95=E0=B8=A3=E0=B8=A7=E0=B8=88?= =?UTF-8?q?=E0=B8=AA=E0=B8=AD=E0=B8=9A=E0=B8=AA=E0=B8=96=E0=B8=B2=E0=B8=99?= =?UTF-8?q?=E0=B8=B0=E0=B8=9C=E0=B8=B9=E0=B9=89=E0=B8=AA=E0=B8=A1=E0=B8=B1?= =?UTF-8?q?=E0=B8=84=E0=B8=A3=E0=B8=AA=E0=B8=AD=E0=B8=9A=20#2518?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OrganizationDotnetController.ts | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/controllers/OrganizationDotnetController.ts b/src/controllers/OrganizationDotnetController.ts index d785a643..8e803569 100644 --- a/src/controllers/OrganizationDotnetController.ts +++ b/src/controllers/OrganizationDotnetController.ts @@ -9153,28 +9153,41 @@ export class OrganizationDotnetController extends Controller { } /** - * API ตรวจสอบ profileId ที่ลาออกแล้ว - * @summary API ตรวจสอบ profileId ที่ลาออกแล้ว + * API ตรวจสอบสถานะผู้สมัครสอบ + * @summary API ตรวจสอบสถานะผู้สมัครสอบ */ @Post("check-isLeave") @Security("internalAuth") async findProfileIsLeave( @Body() - req: { profileIds: string[] } + req: { citizenIds: string[] } ) { - const profile = await this.profileRepo.find({ - select: { id: true }, + + const profiles = await this.profileRepo.find({ + select: { + id: true, + citizenId: true, + isLeave: true, + isActive: true + }, where: { - id: In(req.profileIds), - isLeave: true + citizenId: In(req.citizenIds) } }); - if (profile.length === 0) { + if (profiles.length === 0) { return new HttpSuccess([]); } + + return new HttpSuccess( + profiles.map(p => ({ + citizenId: p.citizenId, + profileId: p.id, + isLeave: p.isLeave ?? false, + isActive: p.isActive ?? false + })) + ); - return new HttpSuccess(profile.map(p => p.id)); } }