diff --git a/apps/api/src/model/report/report.controller.ts b/apps/api/src/model/report/report.controller.ts index 055e88b..db7e36c 100644 --- a/apps/api/src/model/report/report.controller.ts +++ b/apps/api/src/model/report/report.controller.ts @@ -89,6 +89,35 @@ export class ReportController } } + @Get("no-image") + public async findAllButNotWithImage(): Promise[]>> { + try { + const data: ReportModel[] = await this.modelService.find(); + + const simplifiedReportModels = data.map((report) => { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { imageData, ...simplifiedReport } = report; + return simplifiedReport; + }); + + const response: ResponseFormatInterface[]> = formatResponse< + Omit[] + >(true, 200, "Found", simplifiedReportModels); + + this.loggerService.log(`Find All But Not With Image: ${JSON.stringify(response)}`); + + return response; + } catch (error) { + if (error instanceof NotFoundException) { + this.loggerService.error(`Find All But Not With Image: ${error.message}`); + return formatResponse(false, 404, error.message, null); + } + + this.loggerService.error(`Find All But Not With Image: ${error.message}`); + return formatResponse(false, 500, error.message, null); + } + } + @Override public async change( // eslint-disable-next-line @typescript-eslint/no-unused-vars