File size: 710 Bytes
db242f8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | import { Controller, Get, Put } from '@nestjs/common';
import { Public, Role, Roles } from '@/common/guards/auth.guard';
import { ProductService } from './product.service';
@Controller('product')
export class ProductController {
constructor(private readonly productService: ProductService) {}
/* 获取所有产品 */
@Public()
@Get('all')
listProduct() {
return this.productService.listProduct();
}
@Public()
@Get('models')
async listModel() {
return {
success: true,
data: await this.productService.listModel(),
};
}
@Roles(Role.Admin)
@Get('category')
async getAllCategory() {}
@Roles(Role.Admin)
@Put('product')
async updateProduct() {
}
}
|