Conditions | 2 |
Total Lines | 17 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { |
||
24 | |||
25 | @Get('calendar.ics') |
||
26 | @ApiOperation({ summary: 'Export leaves to iCalendar format' }) |
||
27 | public async index(@Res() res: Response): Promise<Response> { |
||
28 | res.header('Content-Type', 'text/calendar;charset=UTF-8'); |
||
29 | res.header('Cache-Control', 'no-store, no-cache, must-revalidate'); |
||
30 | res.attachment('leaves.ics'); |
||
31 | |||
32 | let ics: string; |
||
33 | |||
34 | try { |
||
35 | ics = await this.queryBus.execute(new GetLeavesCalendarQuery()); |
||
36 | } catch (e) { |
||
37 | throw new BadRequestException(e.message); |
||
38 | } |
||
39 | |||
40 | return res.send(ics); |
||
41 | } |
||
43 |