Merge remote-tracking branch 'origin/develop' into develop
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s

This commit is contained in:
Kanjana 2025-04-17 13:43:59 +07:00
commit 5147eed15b

View file

@ -12,6 +12,39 @@ export class EmploymentOfficeController extends Controller {
return this.getEmploymentOfficeListByCriteria(districtId, query);
}
@Post("list-same-office-area")
async getSameOfficeArea(@Body() body: { districtId: string }) {
const office = await prisma.employmentOffice.findFirst({
include: {
province: {
include: {
district: true,
},
},
district: true,
},
where: {
OR: [
{
province: { district: { some: { id: body.districtId } } },
district: { none: {} },
},
{
district: {
some: { districtId: body.districtId },
},
},
],
},
});
if (!office) return [];
return [
...office.district.map((v) => v.districtId),
...office.province.district.map((v) => v.id),
];
}
@Post("list")
async getEmploymentOfficeListByCriteria(
@Query() districtId?: string,