generated from fahricansecer/boilerplate-be
@@ -12,6 +12,9 @@ import {
|
||||
Logger,
|
||||
ParseUUIDPipe,
|
||||
Req,
|
||||
UploadedFile,
|
||||
UseInterceptors,
|
||||
BadRequestException,
|
||||
} from '@nestjs/common';
|
||||
import {
|
||||
ApiTags,
|
||||
@@ -19,9 +22,11 @@ import {
|
||||
ApiResponse,
|
||||
ApiBearerAuth,
|
||||
ApiQuery,
|
||||
ApiConsumes,
|
||||
} from '@nestjs/swagger';
|
||||
import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import { ProjectsService } from './projects.service';
|
||||
import { CreateProjectDto, UpdateProjectDto, CreateFromTweetDto } from './dto/project.dto';
|
||||
import { CreateProjectDto, UpdateProjectDto, CreateFromTweetDto, CreateFromYoutubeDto, CreateFromDocumentDto } from './dto/project.dto';
|
||||
|
||||
@ApiTags('projects')
|
||||
@ApiBearerAuth()
|
||||
@@ -151,6 +156,41 @@ export class ProjectsController {
|
||||
return this.projectsService.createFromTweet(userId, dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* YouTube URL'sinden otomatik proje oluşturur ve senaryo üretir.
|
||||
*/
|
||||
@Post('from-youtube')
|
||||
@HttpCode(HttpStatus.CREATED)
|
||||
@ApiOperation({ summary: 'YouTube videosundan proje oluştur' })
|
||||
@ApiResponse({ status: 201, description: 'YouTube videosundan proje oluşturuldu ve senaryo üretildi' })
|
||||
async createFromYoutube(@Body() dto: CreateFromYoutubeDto, @Req() req: any) {
|
||||
const userId = req.user?.id || req.user?.sub;
|
||||
this.logger.log(`YouTube'dan proje oluşturuluyor: ${dto.youtubeUrl}`);
|
||||
return this.projectsService.createFromYoutube(userId, dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Yüklenen dokümandan (Word, PDF, Excel vb.) otomatik proje oluşturur.
|
||||
*/
|
||||
@Post('from-document')
|
||||
@HttpCode(HttpStatus.CREATED)
|
||||
@UseInterceptors(FileInterceptor('file'))
|
||||
@ApiConsumes('multipart/form-data')
|
||||
@ApiOperation({ summary: 'Dosyadan/Dokümandan proje oluştur' })
|
||||
@ApiResponse({ status: 201, description: 'Belgeden proje oluşturuldu ve senaryo üretildi' })
|
||||
async createFromDocument(
|
||||
@UploadedFile() file: Express.Multer.File,
|
||||
@Body() dto: CreateFromDocumentDto,
|
||||
@Req() req: any,
|
||||
) {
|
||||
const userId = req.user?.id || req.user?.sub;
|
||||
this.logger.log(`Dosyadan proje oluşturuluyor: ${file?.originalname}`);
|
||||
if (!file) {
|
||||
throw new BadRequestException('Dosya yüklenmedi');
|
||||
}
|
||||
return this.projectsService.createFromDocument(userId, file, dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tekil sahne güncelleme (narrasyon, görsel prompt, süre).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user