2024-03-13 13:43:34 +01:00
|
|
|
login_swagger = {
|
|
|
|
"methods": ["POST"],
|
|
|
|
"tags": ["User"],
|
|
|
|
"description": "Logs in using username and password and returns a JWT token for further authorization of requests.\n**The token is valid for 1 hour**",
|
|
|
|
"parameters":
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"in": "body",
|
|
|
|
"name": "body",
|
|
|
|
"description": "Username and password payload",
|
|
|
|
"required": True,
|
|
|
|
"schema":
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"properties":
|
|
|
|
{
|
|
|
|
"username": {"type": "string", "example": "mycoolusername"},
|
|
|
|
"password": {"type": "string", "example": "MyStrongPassword123"}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"responses":
|
|
|
|
{
|
|
|
|
"200":
|
|
|
|
{
|
|
|
|
"description": "Returns a fresh token",
|
|
|
|
"schema":
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"token": {"type": "string", "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTcxMDMyMjkyOCwianRpIjoiZDFhYzQxZDktZjA4NC00MmYzLThlMWUtZWFmZjJiNGU1MDAyIiwidHlwZSI6ImFjY2VzcyIsInN1YiI6MjMwMDEsIm5iZiI6MTcxMDMyMjkyOCwiZXhwIjoxNzEwMzI2NTI4fQ.SW7LAi1j5vDOEIvzeN-sy0eHPP9PFJFkXYY029O35w0"}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"400":
|
|
|
|
{
|
|
|
|
"description": "Possible causes:\n- Missing username or password from request.\n- Nonexistent username"
|
|
|
|
},
|
|
|
|
"401":
|
|
|
|
{
|
|
|
|
"description": "Password is incorrect"
|
|
|
|
}
|
|
|
|
}
|
2024-05-02 20:44:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
logout_swagger = {
|
|
|
|
"methods": ["DELETE"],
|
|
|
|
"tags": ["User"],
|
|
|
|
"security": [{"JWT": []}],
|
|
|
|
"description": "Logs out the user via provided JWT token",
|
|
|
|
"parameters": [],
|
|
|
|
"responses":
|
|
|
|
{
|
|
|
|
"200":
|
|
|
|
{
|
|
|
|
"description": "User successfully logged out"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
delete_swagger = {
|
|
|
|
"methods": ["DELETE"],
|
|
|
|
"tags": ["User"],
|
|
|
|
"security": [{"JWT": []}],
|
|
|
|
"description": "Deletes a user via JWT token",
|
|
|
|
"parameters": [],
|
|
|
|
"responses":
|
|
|
|
{
|
|
|
|
"200":
|
|
|
|
{
|
|
|
|
"description": "User successfully deleted out"
|
|
|
|
}
|
|
|
|
}
|
2024-03-13 13:43:34 +01:00
|
|
|
}
|