Conditions | 2 |
Total Lines | 22 |
Code Lines | 20 |
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: EventDTO, @LoggedUser() user: User) { |
||
33 | try { |
||
34 | const {type, startDate, projectId, taskId, summary, time} = dto; |
||
35 | const id = await this.commandBus.execute( |
||
36 | new AddEventCommand( |
||
37 | type, |
||
38 | user, |
||
39 | Number(time), |
||
40 | new Date(startDate), |
||
41 | projectId, |
||
42 | taskId, |
||
43 | summary |
||
44 | ) |
||
45 | ); |
||
46 | |||
47 | return {id}; |
||
48 | } catch (e) { |
||
49 | throw new BadRequestException(e.message); |
||
50 | } |
||
53 |