2026-02-04 13:49:07 +03:30
|
|
|
import { Body, Controller, Post, UploadedFile, UseInterceptors } from '@nestjs/common'
|
|
|
|
|
import { FileInterceptor } from '@nestjs/platform-express'
|
|
|
|
|
import { ImageUploaderService } from './image-uploader.service'
|
|
|
|
|
|
2026-02-12 20:31:04 +03:30
|
|
|
@Controller('uploaders')
|
|
|
|
|
export class UploadersController {
|
2026-02-04 13:49:07 +03:30
|
|
|
constructor(private readonly imageUploaderService: ImageUploaderService) {}
|
|
|
|
|
|
|
|
|
|
@Post('image')
|
|
|
|
|
@UseInterceptors(FileInterceptor('file'))
|
|
|
|
|
async uploadImage(
|
|
|
|
|
@UploadedFile() file: Express.Multer.File,
|
|
|
|
|
@Body('accountId') accountId: string,
|
|
|
|
|
@Body('type') type: string,
|
|
|
|
|
) {
|
|
|
|
|
const url = await this.imageUploaderService.uploadImage(file, accountId, type)
|
|
|
|
|
return { url }
|
|
|
|
|
}
|
|
|
|
|
}
|