dee96b6e91
- Created response DTOs for ConfigService, AppService, AuthService, CatalogsService, AccountsService, BusinessActivityComplexesService, ComplexPosesService, SalesInvoicesService, BusinessActivitiesService, ConsumerBusinessActivityGoodsService, and others. - Implemented Create, FindAll, FindOne, and Update response types for services in consumer, partners, and POS modules. - Added request DTOs for creating and updating goods in the consumer business activities module. - Introduced filtering DTO for partner licenses. - Enhanced response mapping for partner license activations.
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
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<PartnerServiceMeResponseDto> {
|
|
return this.service.me(id, account_id)
|
|
}
|
|
|
|
@Get('info')
|
|
async getInfo(@PartnerInfo('id') partnerId: string): Promise<PartnerServiceGetInfoResponseDto> {
|
|
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<PartnerServiceUpdateInfoResponseDto> {
|
|
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' |