HTTP 201
This commit is contained in:
parent
b291c20ed6
commit
72fc209349
3 changed files with 10 additions and 3 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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],
|
||||
|
|
Loading…
Reference in a new issue