Conditions | 2 |
Total Lines | 23 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { |
||
28 | |||
29 | @Post() |
||
30 | @Roles(UserRole.COOPERATOR, UserRole.EMPLOYEE) |
||
31 | @ApiOperation({summary: 'Add new event(s)'}) |
||
32 | public async index(@Body() dto: AddEventDTO, @LoggedUser() user: User) { |
||
33 | try { |
||
34 | const {type, startDate, endDate, projectId, taskId, summary, time} = dto; |
||
35 | const result = await this.commandBus.execute( |
||
36 | new AddEventCommand( |
||
37 | type, |
||
38 | user, |
||
39 | Number(time), |
||
40 | new Date(startDate), |
||
41 | new Date(endDate), |
||
42 | projectId, |
||
43 | taskId, |
||
44 | summary |
||
45 | ) |
||
46 | ); |
||
47 | |||
48 | return { ...result }; |
||
49 | } catch (e) { |
||
50 | throw new BadRequestException(e.message); |
||
51 | } |
||
54 |