// src/calendar/calendar.controller.ts import { Body, Controller, Post, Res, UseGuards } from '@nestjs/common'; import { Response } from 'express'; import { IcsMeetingService } from '../service/ics.service'; import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard'; import { CreateInviteDto } from '../dto/ics.dto'; @Controller('/ics') export class IcsMeetingController { constructor(private readonly calendarService: IcsMeetingService) {} // Download ICS file @Post('/create') @UseGuards(JwtAuthGuard) async getIcs(@Body() dto: CreateInviteDto, @Res() res: Response) { const ics = await this.calendarService.generateIcs(dto); res.setHeader('Content-Type', 'text/calendar; charset=utf-8'); res.setHeader('Content-Disposition', 'attachment; filename="invite.ics"'); return res.send(ics); } }