55 lines
2.1 KiB
TypeScript
55 lines
2.1 KiB
TypeScript
|
|
import { TokenAccount } from '@/common/decorators/tokenInfo.decorator'
|
||
|
|
import { Body, Controller, Get, Param, Patch, Post } from '@nestjs/common'
|
||
|
|
import { ApiTags } from '@nestjs/swagger'
|
||
|
|
import { CreateGoodDto, UpdateGoodDto } from './dto/good.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')
|
||
|
|
export class ConsumerBusinessActivityGoodsController {
|
||
|
|
constructor(private readonly service: ConsumerBusinessActivityGoodsService) {}
|
||
|
|
|
||
|
|
@Get()
|
||
|
|
async findAll(
|
||
|
|
@TokenAccount('userId') consumer_id: string,
|
||
|
|
@Param('businessActivityId') businessActivityId: string,
|
||
|
|
): Promise<ConsumerBusinessActivityGoodsServiceFindAllResponseDto> {
|
||
|
|
return this.service.findAll(consumer_id, businessActivityId)
|
||
|
|
}
|
||
|
|
|
||
|
|
@Get(':id')
|
||
|
|
async findOne(
|
||
|
|
@TokenAccount('userId') consumer_id: string,
|
||
|
|
@Param('businessActivityId') businessActivityId: string,
|
||
|
|
|
||
|
|
@Param('id') id: string,
|
||
|
|
): Promise<ConsumerBusinessActivityGoodsServiceFindOneResponseDto> {
|
||
|
|
return this.service.findOne(consumer_id, businessActivityId, id)
|
||
|
|
}
|
||
|
|
|
||
|
|
@Post()
|
||
|
|
async create(
|
||
|
|
@Param('businessActivityId') businessActivityId: string,
|
||
|
|
@Body() data: CreateGoodDto,
|
||
|
|
): Promise<ConsumerBusinessActivityGoodsServiceCreateResponseDto> {
|
||
|
|
return this.service.create(businessActivityId, data)
|
||
|
|
}
|
||
|
|
|
||
|
|
@Patch(':id')
|
||
|
|
async 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)
|
||
|
|
}
|
||
|
|
|
||
|
|
// @Delete(':id')
|
||
|
|
// async delete(@Param('id') id: string) {
|
||
|
|
// return this.businessActivityAccountsService.delete(id)
|
||
|
|
// }
|
||
|
|
}
|