feat: backend API NestJS + Prisma + JWT auth + todos los módulos

This commit is contained in:
Lizandro Guarnizo
2026-06-01 21:23:04 -05:00
parent b31f778b3b
commit 3c5d81603a
69 changed files with 35734 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
import { Controller, Get, Post, Param, Body, UseGuards, Req } from '@nestjs/common';
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
import { ChatService } from './chat.service';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
@ApiTags('Chat')
@Controller('chat')
export class ChatController {
constructor(private chat: ChatService) {}
@Post('start/:professionalId')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
start(@Req() req, @Param('professionalId') professionalId: string) {
return this.chat.getOrCreateChat(req.user.sub, professionalId);
}
@Post(':chatId/message')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
sendMessage(@Req() req, @Param('chatId') chatId: string, @Body() dto: { content: string }) {
return this.chat.sendMessage(chatId, req.user.sub, dto.content);
}
@Get('my')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
myChats(@Req() req) {
return this.chat.getUserChats(req.user.sub);
}
@Get(':chatId/messages')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
messages(@Param('chatId') chatId: string) {
return this.chat.getChatMessages(chatId);
}
}