diff --git a/src/controllers/00-employment-office-controller.ts b/src/controllers/00-employment-office-controller.ts index 700cad9..d73b569 100644 --- a/src/controllers/00-employment-office-controller.ts +++ b/src/controllers/00-employment-office-controller.ts @@ -1,6 +1,7 @@ -import { Controller, Get, Query, Route, Tags } from "tsoa"; +import { Controller, Get, Path, Query, Route, Tags } from "tsoa"; import prisma from "../db"; import { queryOrNot } from "../utils/relation"; +import { notFoundError } from "../utils/error"; @Route("/api/v1/employment-office") @Tags("Employment Office") @@ -27,4 +28,15 @@ export class EmploymentOfficeController extends Controller { orderBy: [{ provinceId: "asc" }, { id: "asc" }], }); } + + @Get("{employmentOfficeId}") + async getEmploymentOffice(@Path() employmentOfficeId: string) { + const record = await prisma.employmentOffice.findFirst({ + where: { id: employmentOfficeId }, + }); + + if (!record) throw notFoundError("Employment Office"); + + return record; + } }