Skip to content

Commit

Permalink
feat: spreadsheetification of lottery export (#4228)
Browse files Browse the repository at this point in the history
* feat: spreadsheetification of lottery export

* fix: updates for tests

* fix: updates per pr comments

* fix: adding test for coverage

* fix: removes un ranked applications from export
  • Loading branch information
YazeedLoonat authored Aug 1, 2024
1 parent add7aff commit fb23902
Show file tree
Hide file tree
Showing 16 changed files with 1,907 additions and 1,226 deletions.
2 changes: 2 additions & 0 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"compression": "^1.7.4",
"cookie-parser": "~1.4.6",
"dayjs": "~1.11.9",
"exceljs": "^4.4.0",
"handlebars": "~4.7.8",
"jsonwebtoken": "~9.0.1",
"lodash": "~4.17.21",
Expand All @@ -80,6 +81,7 @@
"@nestjs/schematics": "^10.1.1",
"@nestjs/testing": "^10.3.2",
"@types/compression": "^1.7.5",
"@types/exceljs": "1.3.0",
"@types/express": "~4.17.17",
"@types/jest": "~29.5.3",
"@types/node": "^18.7.14",
Expand Down
20 changes: 0 additions & 20 deletions api/src/controllers/application.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,6 @@ export class ApplicationController {
return await this.applicationService.mostRecentlyCreated(queryParams, req);
}

@Get(`getLotteryResults`)
@ApiOperation({
summary: 'Get applications lottery results',
operationId: 'lotteryResults',
})
@Header('Content-Type', 'text/csv')
@UseInterceptors(ExportLogInterceptor)
async lotteryExport(
@Request() req: ExpressRequest,
@Res({ passthrough: true }) res: Response,
@Query(new ValidationPipe(defaultValidationPipeOptions))
queryParams: ApplicationCsvQueryParams,
): Promise<StreamableFile> {
return await this.applicationCsvExportService.lotteryExport(
req,
res,
queryParams,
);
}

@Get(`csv`)
@ApiOperation({
summary: 'Get applications as csv',
Expand Down
20 changes: 19 additions & 1 deletion api/src/controllers/lottery.controller.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import {
Body,
Controller,
Get,
Header,
Put,
Query,
Request,
Res,
StreamableFile,
UseGuards,
UseInterceptors,
UsePipes,
Expand Down Expand Up @@ -36,7 +39,6 @@ export class LotteryController {
summary: 'Generate the lottery results for a listing',
operationId: 'lotteryGenerate',
})
@Header('Content-Type', 'text/csv')
@UseInterceptors(ExportLogInterceptor)
async lotteryGenerate(
@Request() req: ExpressRequest,
Expand All @@ -45,4 +47,20 @@ export class LotteryController {
): Promise<SuccessDTO> {
return await this.lotteryService.lotteryGenerate(req, res, queryParams);
}

@Get(`getLotteryResults`)
@ApiOperation({
summary: 'Get applications lottery results',
operationId: 'lotteryResults',
})
@Header('Content-Type', 'application/zip')
@UseInterceptors(ExportLogInterceptor)
async lotteryExport(
@Request() req: ExpressRequest,
@Res({ passthrough: true }) res: Response,
@Query(new ValidationPipe(defaultValidationPipeOptions))
queryParams: ApplicationCsvQueryParams,
): Promise<StreamableFile> {
return await this.lotteryService.lotteryExport(req, res, queryParams);
}
}
Loading

0 comments on commit fb23902

Please sign in to comment.