feat: employment office (#5)
* feat: add table employment office * feat: add tag * feat: add employment office * chore: migrations * feat: order employment office * feat: delete old employment office when special got added
This commit is contained in:
parent
22b3981aa7
commit
401d376a63
6 changed files with 171 additions and 1 deletions
28
src/controllers/00-employment-office-controller.ts
Normal file
28
src/controllers/00-employment-office-controller.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { Controller, Get, Query, Route, Tags } from "tsoa";
|
||||
import prisma from "../db";
|
||||
|
||||
@Route("/api/v1/employment-office")
|
||||
@Tags("Employment Office")
|
||||
export class EmploymentOfficeController extends Controller {
|
||||
@Get()
|
||||
async getEmploymentOfficeList(@Query() districtId?: string) {
|
||||
return await prisma.employmentOffice.findMany({
|
||||
where: {
|
||||
OR: [
|
||||
{
|
||||
province: {
|
||||
district: { some: { id: districtId } },
|
||||
},
|
||||
district: { none: {} },
|
||||
},
|
||||
{
|
||||
district: {
|
||||
some: { districtId },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
orderBy: [{ provinceId: "asc" }, { id: "asc" }],
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue