feat: CRUD for product barcode images
This commit is contained in:
@@ -164,3 +164,40 @@ async def upload_product_image(
|
||||
):
|
||||
file_bytes = upload_file.file.read()
|
||||
return await ProductService(session).upload_image(product_id, file_bytes)
|
||||
|
||||
|
||||
@product_router.post(
|
||||
'/barcode/upload-image/{product_id}',
|
||||
response_model=ProductUploadBarcodeImageResponse,
|
||||
operation_id='upload_product_barcode_image'
|
||||
)
|
||||
async def upload_product_barcode_image(
|
||||
product_id: int,
|
||||
upload_file: UploadFile,
|
||||
session: Annotated[AsyncSession, Depends(get_session)]
|
||||
):
|
||||
return await ProductService(session).upload_barcode_image(product_id, upload_file)
|
||||
|
||||
|
||||
@product_router.post(
|
||||
'/barcode/delete-image/{product_id}',
|
||||
response_model=ProductDeleteBarcodeImageResponse,
|
||||
operation_id='delete_product_barcode_image'
|
||||
)
|
||||
async def delete_product_barcode_image(
|
||||
product_id: int,
|
||||
session: Annotated[AsyncSession, Depends(get_session)]
|
||||
):
|
||||
return await ProductService(session).delete_barcode_image(product_id)
|
||||
|
||||
|
||||
@product_router.post(
|
||||
'/barcode/image/{product_id}',
|
||||
response_model=ProductGetBarcodeImageResponse,
|
||||
operation_id='get_product_barcode_image'
|
||||
)
|
||||
async def get_product_barcode_image(
|
||||
product_id: int,
|
||||
session: Annotated[AsyncSession, Depends(get_session)]
|
||||
):
|
||||
return await ProductService(session).get_barcode_image(product_id)
|
||||
|
||||
Reference in New Issue
Block a user