crappy
This commit is contained in:
@@ -62,3 +62,49 @@ async def get_product(
|
||||
session: Annotated[AsyncSession, Depends(get_session)]
|
||||
):
|
||||
return await ProductService(session).get_by_client_id(client_id, pagination)
|
||||
|
||||
|
||||
@product_router.get('/get-by-id',
|
||||
response_model=ProductSchema,
|
||||
operation_id='get_product_by_id')
|
||||
async def get_product_by_id(
|
||||
product_id: int,
|
||||
session: Annotated[AsyncSession, Depends(get_session)]
|
||||
):
|
||||
return await ProductService(session).get_by_id(product_id)
|
||||
|
||||
|
||||
@product_router.post(
|
||||
'/barcode/add',
|
||||
response_model=ProductAddBarcodeResponse,
|
||||
operation_id='add_product_barcode'
|
||||
)
|
||||
async def add_product_barcode(
|
||||
request: ProductAddBarcodeRequest,
|
||||
session: Annotated[AsyncSession, Depends(get_session)]
|
||||
):
|
||||
return await ProductService(session).add_barcode(request)
|
||||
|
||||
|
||||
@product_router.get(
|
||||
'/barcode/exists',
|
||||
response_model=ProductExistsBarcodeResponse,
|
||||
operation_id='exists_product_barcode'
|
||||
)
|
||||
async def exists_product_barcode(
|
||||
product_id: int,
|
||||
barcode: str,
|
||||
session: Annotated[AsyncSession, Depends(get_session)]
|
||||
):
|
||||
return await ProductService(session).exists_barcode(product_id, barcode)
|
||||
|
||||
@product_router.post(
|
||||
'/barcode/generate',
|
||||
response_model=ProductGenerateBarcodeResponse,
|
||||
operation_id='generate_product_barcode'
|
||||
)
|
||||
async def generate_product_barcode(
|
||||
request: ProductGenerateBarcodeRequest,
|
||||
session: Annotated[AsyncSession, Depends(get_session)]
|
||||
):
|
||||
return await ProductService(session).generate_barcode(request)
|
||||
|
||||
Reference in New Issue
Block a user