Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | import { Controller, Post, Put, Param, Body, Req } from '@nestjs/common'; import { TimeTrackingService } from '../services/time-tracking.service'; import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger'; @Controller('api/v1/time') @ApiTags('Time') export class TimeController { constructor(private readonly timeService: TimeTrackingService) {} @Post('start') @ApiOperation({ summary: 'Start timer operation' }) @ApiResponse({ status: 201, description: 'Operation successful' }) async startTimer(@Req() req: any, @Body() data: any): Promise<any> { const tenantId = req.user?.tenantId || 'dummy-tenant-id'; const employeeId = req.user?.employeeId || 'dummy-emp-id'; return this.timeService.startTimer( tenantId, employeeId, data.projectId, data.taskId, ); } @Put('stop/:entryId') @ApiOperation({ summary: 'Stop timer operation' }) @ApiResponse({ status: 200, description: 'Operation successful' }) async stopTimer( @Req() req: any, @Param('entryId') entryId: string, ): Promise<any> { const tenantId = req.user?.tenantId || 'dummy-tenant-id'; return this.timeService.stopTimer(tenantId, entryId); } @Post('manual') @ApiOperation({ summary: 'Log manual operation' }) @ApiResponse({ status: 201, description: 'Operation successful' }) async logManual(@Req() req: any, @Body() data: any): Promise<any> { const tenantId = req.user?.tenantId || 'dummy-tenant-id'; return this.timeService.logManualTime(tenantId, data); } } |