diff --git a/src/borough/borough.controller.ts b/src/borough/borough.controller.ts index 247332ec..2deaedc9 100644 --- a/src/borough/borough.controller.ts +++ b/src/borough/borough.controller.ts @@ -51,9 +51,7 @@ export class BoroughController { } @Get("/:boroughId/community-districts/:communityDistrictId/capital-projects") - @UsePipes( - new ZodValidationPipe(findCapitalProjectsByBoroughIdCommunityDistrictIdPathParamsSchema), - ) + // TODO: Add validation pipes async findCapitalProjectsByBoroughIdCommunityDistrictId( @Param() pathParams: FindCapitalProjectsByBoroughIdCommunityDistrictIdPathParams, @Query() queryParams: FindCapitalProjectsByBoroughIdCommunityDistrictIdQueryParams, diff --git a/src/borough/borough.repository.ts b/src/borough/borough.repository.ts index 9cdae0b6..899e821d 100644 --- a/src/borough/borough.repository.ts +++ b/src/borough/borough.repository.ts @@ -26,6 +26,7 @@ export class BoroughRepository { .prepare("checkBoroughById"); async checkBoroughById(id: string): Promise { + console.log("check borough by id"); try { return await this.#checkBoroughById.execute({ id, @@ -45,6 +46,7 @@ export class BoroughRepository { .prepare("checkCommunityDistrictId"); async checkCommunityDistrictById(id: string): Promise { + console.log("check community district by id"); try { return await this.#checkCommunityDistrictById.execute({ id, diff --git a/src/borough/borough.service.ts b/src/borough/borough.service.ts index 7968dca7..baa6698d 100644 --- a/src/borough/borough.service.ts +++ b/src/borough/borough.service.ts @@ -38,18 +38,22 @@ export class BoroughService { FindCapitalProjectsByBoroughIdCommunityDistrictIdQueryParams) { const boroughCheck = await this.boroughRepository.checkBoroughById(boroughId); + if (boroughCheck === undefined) throw new ResourceNotFoundException(); + const communityDistrictCheck = await this.boroughRepository.checkCommunityDistrictById(communityDistrictId); + if (communityDistrictCheck === undefined) throw new ResourceNotFoundException(); - const capitalProjects = await this.boroughRepository.findCapitalProjectsByBoroughIdCommunityDistrictId({ + const capitalProjects = await this.boroughRepository.findCapitalProjectsByBoroughIdCommunityDistrictId({ boroughId, communityDistrictId, limit, offset, - }); - - console.log(capitalProjects); + }) return { - capitalProjects, + limit, + offset, + total: capitalProjects.length, + order: "managingCode, capitalProjectId", capitalProjects, } } }