All files / src/platform/calendar mobile-calendar.controller.ts

0% Statements 0/15
0% Branches 0/12
0% Functions 0/3
0% Lines 0/13

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                                                             
import { Controller, Get, Post, Body, Param, Req } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { CalendarService } from './calendar.service';
 
@ApiTags('Mobile Calendar')
@Controller('api/v1/mobile/calendar')
export class MobileCalendarController {
  constructor(private readonly calendarSvc: CalendarService) {}
 
  @Get('events/my')
  @ApiOperation({ summary: 'Get current logged-in employee events' })
  async getMyEvents(@Req() req: any) {
    const tenantId = req.headers['x-tenant-id'] || 'default-tenant';
    // Mock user identification (would normally come from auth guard)
    const employeeId = req.headers['x-employee-id'] || 'default-employee';
    return { employeeId, tenantId, events: [] };
  }
 
  @Post('events/:id/respond')
  @ApiOperation({ summary: 'Respond to invitation from mobile app' })
  async respondFromMobile(
    @Req() req: any,
    @Param('id') eventId: string,
    @Body() body: { responseStatus: string; comment?: string }
  ) {
    const tenantId = req.headers['x-tenant-id'] || 'default-tenant';
    const employeeId = req.headers['x-employee-id'] || 'default-employee';
    return this.calendarSvc.respondToInvite(tenantId, eventId, employeeId, body.responseStatus, body.comment);
  }
}