feat: expose image endpoint to public

This commit is contained in:
Methapon2001 2024-06-18 10:56:28 +07:00
parent 212fec4f14
commit a018f69f91

View file

@ -55,9 +55,9 @@ function imageLocation(id: string) {
@Route("api/v1/product")
@Tags("Product")
@Security("keycloak")
export class ProductController extends Controller {
@Get()
@Security("keycloak")
async getProduct(
@Query() status?: Status,
@Query() productTypeId?: string,
@ -108,6 +108,7 @@ export class ProductController extends Controller {
}
@Get("{productId}")
@Security("keycloak")
async getProductById(@Path() productId: string) {
const record = await prisma.product.findFirst({
where: { id: productId },
@ -134,6 +135,7 @@ export class ProductController extends Controller {
}
@Post()
@Security("keycloak")
async createProduct(@Request() req: RequestWithUser, @Body() body: ProductCreate) {
const productType = await prisma.productType.findFirst({
where: { id: body.productTypeId },
@ -190,6 +192,7 @@ export class ProductController extends Controller {
}
@Put("{productId}")
@Security("keycloak")
async editProduct(
@Request() req: RequestWithUser,
@Body() body: ProductUpdate,
@ -231,6 +234,7 @@ export class ProductController extends Controller {
}
@Delete("{productId}")
@Security("keycloak")
async deleteProduct(@Path() productId: string) {
const record = await prisma.product.findFirst({ where: { id: productId } });