2026-04-27 10:45:39 +03:30
|
|
|
import { multerImageOptions } from '@/multer.config'
|
|
|
|
|
import {
|
|
|
|
|
Body,
|
|
|
|
|
Controller,
|
|
|
|
|
Get,
|
|
|
|
|
Param,
|
|
|
|
|
Patch,
|
|
|
|
|
Post,
|
|
|
|
|
UploadedFile,
|
|
|
|
|
UseInterceptors,
|
|
|
|
|
} from '@nestjs/common'
|
|
|
|
|
import { FileInterceptor } from '@nestjs/platform-express'
|
|
|
|
|
import { ApiBody, ApiConsumes } from '@nestjs/swagger'
|
2026-04-16 22:19:20 +03:30
|
|
|
import { CreatePartnerDto, UpdatePartnerDto } from './dto/partner.dto'
|
2026-03-07 11:25:11 +03:30
|
|
|
import { PartnersService } from './partners.service'
|
|
|
|
|
|
|
|
|
|
@Controller('admin/partners')
|
|
|
|
|
export class PartnersController {
|
|
|
|
|
constructor(private readonly partnersService: PartnersService) {}
|
|
|
|
|
|
|
|
|
|
@Get()
|
2026-04-27 10:45:39 +03:30
|
|
|
async findAll(): Promise<PartnersServiceFindAllResponseDto> {
|
2026-03-07 11:25:11 +03:30
|
|
|
return this.partnersService.findAll()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Get(':id')
|
2026-04-27 10:45:39 +03:30
|
|
|
async findOne(@Param('id') id: string): Promise<PartnersServiceFindOneResponseDto> {
|
2026-03-07 11:25:11 +03:30
|
|
|
return this.partnersService.findOne(id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post()
|
2026-04-27 10:45:39 +03:30
|
|
|
@UseInterceptors(FileInterceptor('logo', multerImageOptions))
|
|
|
|
|
@ApiConsumes('multipart/form-data')
|
|
|
|
|
@ApiBody({
|
|
|
|
|
schema: {
|
|
|
|
|
type: 'object',
|
|
|
|
|
properties: {
|
|
|
|
|
logo: { type: 'string', format: 'binary' },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
async create(@Body() data: CreatePartnerDto, @UploadedFile() logo: any): Promise<PartnersServiceCreateResponseDto> {
|
|
|
|
|
return this.partnersService.create(data, logo)
|
2026-03-07 11:25:11 +03:30
|
|
|
}
|
|
|
|
|
|
2026-03-14 16:26:44 +03:30
|
|
|
@Patch(':id')
|
2026-04-27 10:45:39 +03:30
|
|
|
@UseInterceptors(FileInterceptor('logo', multerImageOptions))
|
|
|
|
|
@ApiConsumes('multipart/form-data')
|
|
|
|
|
@ApiBody({
|
|
|
|
|
schema: {
|
|
|
|
|
type: 'object',
|
|
|
|
|
properties: {
|
|
|
|
|
logo: { type: 'string', format: 'binary' },
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
async update(
|
|
|
|
|
@Param('id') id: string,
|
|
|
|
|
@Body() data: UpdatePartnerDto,
|
|
|
|
|
@UploadedFile() logo: Express.Multer.File,
|
|
|
|
|
): Promise<PartnersServiceUpdateResponseDto> {
|
|
|
|
|
return this.partnersService.update(id, data, logo)
|
2026-03-07 11:25:11 +03:30
|
|
|
}
|
|
|
|
|
|
2026-04-16 22:19:20 +03:30
|
|
|
// @Delete(':id')
|
|
|
|
|
// async delete(@Param('id') id: string) {
|
|
|
|
|
// return this.partnersService.delete(id)
|
|
|
|
|
// }
|
2026-03-07 11:25:11 +03:30
|
|
|
}
|
2026-04-27 10:45:39 +03:30
|
|
|
|
|
|
|
|
import type { PartnersServiceCreateResponseDto, PartnersServiceFindAllResponseDto, PartnersServiceFindOneResponseDto, PartnersServiceUpdateResponseDto } from './dto/partners-response.dto'
|