import { Controller, Get, Post, Body, Req, UseGuards } from '@nestjs/common'; import { ApiTags, ApiBearerAuth } from '@nestjs/swagger'; import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard'; import { IdeasService } from './ideas.service'; import { CreateIdeaDto } from './dto/create-idea.dto'; @ApiTags('ideas') @Controller('ideas') @ApiBearerAuth() @UseGuards(JwtAuthGuard) export class IdeasController { constructor(private ideasService: IdeasService) {} @Post() async create(@Req() req: any, @Body() dto: CreateIdeaDto) { const orgId = req.user.orgId; const userId = req.user.userId || req.user.sub; const idea = await this.ideasService.create(orgId, userId, dto); return { success: true, idea }; } @Get() async findByOrg(@Req() req: any) { const orgId = req.user.orgId; return this.ideasService.findByOrg(orgId); } }