feat: product barcode images

This commit is contained in:
2025-10-21 11:10:08 +04:00
parent 90c0bae8f1
commit 83f3b55f49
6 changed files with 115 additions and 24 deletions

View File

@ -49,16 +49,16 @@ async def update_product(
@router.post(
"/images/upload/{productId}",
"{pk}/images/upload",
response_model=ProductUploadImageResponse,
operation_id="upload_product_image",
)
async def upload_product_image(
session: SessionDependency,
upload_file: Annotated[UploadFile, File()],
product_id: int = Path(alias="productId"),
pk: int = Path(),
):
return await ProductService(session).upload_image(product_id, upload_file)
return await ProductService(session).upload_image(pk, upload_file)
@router.delete(
@ -86,3 +86,28 @@ async def get_product_barcode_pdf(
return GetProductBarcodePdfResponse(
base64_string=base64_string, filename=filename, mime_type="application/pdf"
)
@router.post(
"{pk}/barcode/image/upload",
response_model=BarcodeUploadImageResponse,
operation_id="upload_product_barcode_image",
)
async def upload_product_barcode_image(
upload_file: UploadFile,
session: SessionDependency,
pk: int,
):
return await ProductService(session).upload_barcode_image(pk, upload_file)
@router.delete(
"{pk}/barcode/image",
response_model=DeleteBarcodeImageResponse,
operation_id="delete_product_barcode_image",
)
async def delete_product_barcode_image(
session: SessionDependency,
pk: int,
):
return await ProductService(session).delete_barcode_image(pk)