11import json
22from io import BytesIO
3+ from typing import Annotated
34
4- from fastapi import Request , UploadFile
5+ from fastapi import Path as PathVar
6+ from fastapi import Request , UploadFile , status
57
68from config import str_to_bool
79from decorators .auth import protected_route
@@ -388,22 +390,18 @@ async def update_smart_collection(
388390 return SmartCollectionSchema .model_validate (smart_collection )
389391
390392
391- @protected_route (router .delete , "/{id}" , [Scope .COLLECTIONS_WRITE ])
392- async def delete_collection (request : Request , id : int ) -> None :
393- """Delete collections endpoint
394-
395- Args:
396- request (Request): Fastapi Request object
397- {
398- "collections": List of rom's ids to delete
399- }
400-
401- Raises:
402- HTTPException: Collection not found
403- """
404-
393+ @protected_route (
394+ router .delete ,
395+ "/{id}" ,
396+ [Scope .COLLECTIONS_WRITE ],
397+ responses = {status .HTTP_404_NOT_FOUND : {}},
398+ )
399+ async def delete_collection (
400+ request : Request ,
401+ id : Annotated [int , PathVar (description = "Collection internal id." , ge = 1 )],
402+ ) -> None :
403+ """Delete a collection by ID."""
405404 collection = db_collection_handler .get_collection (id )
406-
407405 if not collection :
408406 raise CollectionNotFoundInDatabaseException (id )
409407
@@ -418,17 +416,18 @@ async def delete_collection(request: Request, id: int) -> None:
418416 )
419417
420418
421- @protected_route (router .delete , "/smart/{id}" , [Scope .COLLECTIONS_WRITE ])
422- async def delete_smart_collection (request : Request , id : int ) -> None :
423- """Delete smart collection endpoint
424-
425- Args:
426- request (Request): Fastapi Request object
427- id (int): Smart collection id
428- """
429-
419+ @protected_route (
420+ router .delete ,
421+ "/smart/{id}" ,
422+ [Scope .COLLECTIONS_WRITE ],
423+ responses = {status .HTTP_404_NOT_FOUND : {}},
424+ )
425+ async def delete_smart_collection (
426+ request : Request ,
427+ id : Annotated [int , PathVar (description = "Smart collection internal id." , ge = 1 )],
428+ ) -> None :
429+ """Delete a smart collection by ID."""
430430 smart_collection = db_collection_handler .get_smart_collection (id )
431-
432431 if not smart_collection :
433432 raise CollectionNotFoundInDatabaseException (id )
434433
0 commit comments