diff --git a/api/kiwi_vpn_api/routers/_common.py b/api/kiwi_vpn_api/routers/_common.py index fc8035c..3b76e30 100644 --- a/api/kiwi_vpn_api/routers/_common.py +++ b/api/kiwi_vpn_api/routers/_common.py @@ -39,6 +39,10 @@ class Responses: "description": "Operation not permitted", "content": None, } + ENTRY_ADDED = { + "description": "Entry added to database", + "content": None, + } ENTRY_EXISTS = { "description": "Entry exists in database", "content": None, diff --git a/api/kiwi_vpn_api/routers/device.py b/api/kiwi_vpn_api/routers/device.py index 4ec8876..44cc144 100644 --- a/api/kiwi_vpn_api/routers/device.py +++ b/api/kiwi_vpn_api/routers/device.py @@ -14,7 +14,7 @@ router = APIRouter(prefix="/device", tags=["device"]) @router.post( "/{user_name}", responses={ - status.HTTP_200_OK: Responses.OK, + status.HTTP_201_CREATED: Responses.ENTRY_ADDED, status.HTTP_400_BAD_REQUEST: Responses.NOT_INSTALLED, status.HTTP_401_UNAUTHORIZED: Responses.NEEDS_USER, status.HTTP_403_FORBIDDEN: Responses.NEEDS_PERMISSION, @@ -22,6 +22,7 @@ router = APIRouter(prefix="/device", tags=["device"]) status.HTTP_409_CONFLICT: Responses.ENTRY_EXISTS, }, response_model=DeviceRead, + status_code=status.HTTP_201_CREATED, ) async def add_device( device: DeviceCreate, diff --git a/api/kiwi_vpn_api/routers/user.py b/api/kiwi_vpn_api/routers/user.py index 758d782..df22934 100644 --- a/api/kiwi_vpn_api/routers/user.py +++ b/api/kiwi_vpn_api/routers/user.py @@ -63,13 +63,14 @@ async def get_current_user_route( @router.post( "", responses={ - status.HTTP_200_OK: Responses.OK, + status.HTTP_201_CREATED: Responses.ENTRY_ADDED, status.HTTP_400_BAD_REQUEST: Responses.NOT_INSTALLED, status.HTTP_401_UNAUTHORIZED: Responses.NEEDS_USER, status.HTTP_403_FORBIDDEN: Responses.NEEDS_PERMISSION, status.HTTP_409_CONFLICT: Responses.ENTRY_EXISTS, }, response_model=UserRead, + status_code=status.HTTP_201_CREATED, ) async def add_user( user: UserCreate, @@ -127,11 +128,12 @@ async def remove_user( @router.post( "/{user_name}/tags", responses={ - status.HTTP_200_OK: Responses.OK, + status.HTTP_201_CREATED: Responses.ENTRY_ADDED, status.HTTP_400_BAD_REQUEST: Responses.NOT_INSTALLED, status.HTTP_401_UNAUTHORIZED: Responses.NEEDS_USER, status.HTTP_403_FORBIDDEN: Responses.NEEDS_PERMISSION, }, + status_code=status.HTTP_201_CREATED, ) async def extend_tags( tags: list[TagValue],