feat: add stock keeping units management
- Created migration to drop `type` column from `stock_keeping_units` table. - Added `Guild` model to Prisma schema. - Implemented `BusinessActivitiesQueryService` for querying business activities. - Developed `GoodsSharedService` for handling goods creation and updates. - Introduced DTOs for creating and updating stock keeping units. - Created controller and service for managing stock keeping units. - Implemented response DTOs for stock keeping units service. - Established module for stock keeping units management.
This commit is contained in:
@@ -1,9 +1,23 @@
|
||||
import { TokenAccount } from '@/common/decorators/tokenInfo.decorator'
|
||||
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common'
|
||||
import { ApiTags } from '@nestjs/swagger'
|
||||
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, ApiTags } from '@nestjs/swagger'
|
||||
import { CreateGoodDto, UpdateGoodDto } from './dto/good.dto'
|
||||
import type {
|
||||
ConsumerBusinessActivityGoodsServiceFindAllResponseDto,
|
||||
ConsumerBusinessActivityGoodsServiceFindOneResponseDto,
|
||||
} from './dto/goods-response.dto'
|
||||
import { ConsumerBusinessActivityGoodsService } from './goods.service'
|
||||
import type { ConsumerBusinessActivityGoodsServiceCreateResponseDto, ConsumerBusinessActivityGoodsServiceFindAllResponseDto, ConsumerBusinessActivityGoodsServiceFindOneResponseDto, ConsumerBusinessActivityGoodsServiceUpdateResponseDto } from './dto/goods-response.dto'
|
||||
|
||||
@ApiTags('ConsumerBusinessActivityGoods')
|
||||
@Controller('consumer/business_activities/:businessActivityId/goods')
|
||||
@@ -29,22 +43,44 @@ export class ConsumerBusinessActivityGoodsController {
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(
|
||||
@UseInterceptors(FileInterceptor('image', multerImageOptions))
|
||||
@ApiConsumes('multipart/form-data')
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
image: { type: 'string', format: 'binary' },
|
||||
},
|
||||
},
|
||||
})
|
||||
create(
|
||||
@Param('businessActivityId') businessActivityId: string,
|
||||
@Body() data: CreateGoodDto,
|
||||
): Promise<ConsumerBusinessActivityGoodsServiceCreateResponseDto> {
|
||||
return this.service.create(businessActivityId, data)
|
||||
@UploadedFile() file: Express.Multer.File,
|
||||
) {
|
||||
return this.service.create(businessActivityId, data, file)
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
async update(
|
||||
@UseInterceptors(FileInterceptor('image', multerImageOptions))
|
||||
@ApiConsumes('multipart/form-data')
|
||||
@ApiBody({
|
||||
schema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
image: { type: 'string', format: 'binary' },
|
||||
},
|
||||
},
|
||||
})
|
||||
update(
|
||||
@TokenAccount('userId') consumer_id: string,
|
||||
@Param('businessActivityId') businessActivityId: string,
|
||||
|
||||
@Param('id') id: string,
|
||||
@Body() data: UpdateGoodDto,
|
||||
): Promise<ConsumerBusinessActivityGoodsServiceUpdateResponseDto> {
|
||||
return this.service.update(consumer_id, businessActivityId, id, data)
|
||||
@UploadedFile() file: Express.Multer.File,
|
||||
) {
|
||||
return this.service.update(consumer_id, businessActivityId, id, data, file)
|
||||
}
|
||||
|
||||
// @Delete(':id')
|
||||
|
||||
Reference in New Issue
Block a user