import { PartnerInfo } from '@/common/decorators/partnerInfo.decorator' import { multerImageOptions } from '@/multer.config' import { Body, Controller, Get, Patch, UploadedFile, UseInterceptors, } from '@nestjs/common' import { FileInterceptor } from '@nestjs/platform-express' import { ApiBody, ApiConsumes, ApiTags } from '@nestjs/swagger' import { UpdatePartnerProfileDto } from './dto/partner.dto' import { PartnerService } from './partners.service' @ApiTags('Partner') @Controller('partner') export class PartnerController { constructor(private service: PartnerService) {} @Get('') async me(@PartnerInfo() { id, account_id }: IPartnerPayload): Promise { return this.service.me(id, account_id) } @Get('info') async getInfo(@PartnerInfo('id') partnerId: string): Promise { return this.service.getInfo(partnerId) } @Patch('profile') @UseInterceptors(FileInterceptor('logo', multerImageOptions)) @ApiConsumes('multipart/form-data') @ApiBody({ schema: { type: 'object', properties: { logo: { type: 'string', format: 'binary' }, }, }, }) async update( @PartnerInfo('id') partnerId: string, @Body() data: UpdatePartnerProfileDto, @UploadedFile() logo: Express.Multer.File, ): Promise { return this.service.updateInfo(partnerId, data, logo) } } import type { IPartnerPayload } from '@/common/models/partnerPayload.model' import type { PartnerServiceGetInfoResponseDto, PartnerServiceMeResponseDto, PartnerServiceUpdateInfoResponseDto } from './dto/partners-response.dto'