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
+19
View File
@@ -0,0 +1,19 @@
import { Controller, Post, UseGuards, Req, UploadedFile, UseInterceptors } from '@nestjs/common';
import { FileInterceptor } from '@nestjs/platform-express';
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
import { StorageService } from './storage.service';
@ApiTags('Storage')
@Controller('storage')
export class StorageController {
constructor(private storage: StorageService) {}
@Post('upload')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
@UseInterceptors(FileInterceptor('file'))
upload(@UploadedFile() file: any) {
return { url: this.storage.getUploadUrl(file?.originalname) };
}
}
+9
View File
@@ -0,0 +1,9 @@
import { Module } from '@nestjs/common';
import { StorageService } from './storage.service';
import { StorageController } from './storage.controller';
@Module({
providers: [StorageService],
controllers: [StorageController],
})
export class StorageModule {}
+14
View File
@@ -0,0 +1,14 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class StorageService {
private baseUrl: string;
constructor() {
this.baseUrl = process.env.STORAGE_URL || 'http://localhost:9000';
}
getUploadUrl(fileName: string) {
return `${this.baseUrl}/uploads/${fileName}`;
}
}