Merge remote-tracking branch 'origin/develop' into develop
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
This commit is contained in:
commit
5147eed15b
1 changed files with 33 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue