rename
This commit is contained in:
@@ -58,8 +58,8 @@ export class FoodController {
|
||||
@ApiHeader(API_HEADER_SLUG)
|
||||
@ApiBearerAuth()
|
||||
@ApiOperation({ summary: 'get my favorites' })
|
||||
getMyFavorites(@UserId() userId: string, @ShopId() restId: string) {
|
||||
return this.productService.getMyFavorites(userId, restId);
|
||||
getMyFavorites(@UserId() userId: string, @ShopId() shopId: string) {
|
||||
return this.productService.getMyFavorites(userId, shopId);
|
||||
}
|
||||
|
||||
/* ---------------------------------- Admin ---------------------------------- */
|
||||
@@ -68,8 +68,8 @@ export class FoodController {
|
||||
@Permissions(Permission.MANAGE_FOODS)
|
||||
@Post('admin/products')
|
||||
@ApiOperation({ summary: 'Create a new product' })
|
||||
create(@Body() createFoodDto: CreateProductDto, @ShopId() restId: string) {
|
||||
return this.productService.create(restId, createFoodDto);
|
||||
create(@Body() createFoodDto: CreateProductDto, @ShopId() shopId: string) {
|
||||
return this.productService.create(shopId, createFoodDto);
|
||||
}
|
||||
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@@ -84,8 +84,8 @@ export class FoodController {
|
||||
@ApiQuery({ name: 'order', required: false, enum: ['asc', 'desc'] })
|
||||
@ApiQuery({ name: 'categoryId', required: false, type: String })
|
||||
@ApiQuery({ name: 'isActive', required: false, type: Boolean })
|
||||
async findAll(@Query() dto: FindProductsDto, @ShopId() restId: string) {
|
||||
const result = await this.productService.findAll(restId, dto);
|
||||
async findAll(@Query() dto: FindProductsDto, @ShopId() shopId: string) {
|
||||
const result = await this.productService.findAll(shopId, dto);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -95,8 +95,8 @@ export class FoodController {
|
||||
@Get('admin/products/:id')
|
||||
@ApiOperation({ summary: 'Get a product by id' })
|
||||
@ApiParam({ name: 'id', required: true })
|
||||
findById(@Param('id') id: string, @ShopId() restId: string) {
|
||||
return this.productService.findAdminById(restId, id);
|
||||
findById(@Param('id') id: string, @ShopId() shopId: string) {
|
||||
return this.productService.findAdminById(shopId, id);
|
||||
}
|
||||
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@@ -106,15 +106,15 @@ export class FoodController {
|
||||
@ApiOperation({ summary: 'Update a product' })
|
||||
@ApiParam({ name: 'id', required: true })
|
||||
@ApiBody({ type: UpdateFoodDto })
|
||||
update(@Param('id') id: string, @Body() updateFoodDto: UpdateFoodDto, @ShopId() restId: string) {
|
||||
return this.productService.update(restId, id, updateFoodDto);
|
||||
update(@Param('id') id: string, @Body() updateFoodDto: UpdateFoodDto, @ShopId() shopId: string) {
|
||||
return this.productService.update(shopId, id, updateFoodDto);
|
||||
}
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@Permissions(Permission.MANAGE_FOODS)
|
||||
@Delete('admin/products/:id')
|
||||
@ApiOperation({ summary: 'Delete (soft) a product' })
|
||||
remove(@Param('id') id: string, @ShopId() restId: string) {
|
||||
return this.productService.remove(restId, id);
|
||||
remove(@Param('id') id: string, @ShopId() shopId: string) {
|
||||
return this.productService.remove(shopId, id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user