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)); } }