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.
71 lines
2.0 KiB
TypeScript
71 lines
2.0 KiB
TypeScript
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'
|
|
import { CreatePartnerDto, UpdatePartnerDto } from './dto/partner.dto'
|
|
import { PartnersService } from './partners.service'
|
|
|
|
@Controller('admin/partners')
|
|
export class PartnersController {
|
|
constructor(private readonly partnersService: PartnersService) {}
|
|
|
|
@Get()
|
|
async findAll(): Promise<PartnersServiceFindAllResponseDto> {
|
|
return this.partnersService.findAll()
|
|
}
|
|
|
|
@Get(':id')
|
|
async findOne(@Param('id') id: string): Promise<PartnersServiceFindOneResponseDto> {
|
|
return this.partnersService.findOne(id)
|
|
}
|
|
|
|
@Post()
|
|
@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)
|
|
}
|
|
|
|
@Patch(':id')
|
|
@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)
|
|
}
|
|
|
|
// @Delete(':id')
|
|
// async delete(@Param('id') id: string) {
|
|
// return this.partnersService.delete(id)
|
|
// }
|
|
}
|
|
|
|
import type { PartnersServiceCreateResponseDto, PartnersServiceFindAllResponseDto, PartnersServiceFindOneResponseDto, PartnersServiceUpdateResponseDto } from './dto/partners-response.dto' |