Image now a file

This commit is contained in:
2024-07-21 18:28:19 +02:00
parent 8d91e805dd
commit b3c5841e36
17 changed files with 346 additions and 36 deletions
+126 -2
View File
@@ -27,6 +27,15 @@ paths:
examples:
Success:
value: true
400:
description: Missing Fields
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
examples:
Missing Fields:
value: { "message": "Missing email" }
401:
description: Invalid credentials
content:
@@ -74,6 +83,97 @@ paths:
value: true
tags:
- Login/Logout
/user{id}:
get:
summary: Get user
description: Get user by ID
security:
- BasicAuth: []
parameters:
- name: id
in: path
description: User ID
required: true
schema:
type: integer
format: int14
responses:
200:
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/UserResponse"
examples:
Success:
value:
{
"id": 1,
"username": "Admin",
"status": 1,
"email": "marvin@zedat.fu-berlin.de",
"image": "profilbilder\\/admin.svg",
"isAdmin": true,
}
404:
description: User not Found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
examples:
User not Found:
value: { "message": "User not Found" }
tags:
- User
post:
summary: Update user
description: Update user with ID. Fields are updated in order username,password,image. If one fails, subsequent are not updated
security:
- BasicAuth: []
parameters:
- name: id
in: path
description: User ID
required: true
schema:
type: integer
format: int14
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/UserUpdateRequest"
responses:
200:
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/BooleanResponse"
examples:
Success:
value: true
404:
description: User not Found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
examples:
User not Found:
value: { "message": "User not Found" }
500:
description: Update failed
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
examples:
User not Found:
value: { "message": "Failed to update username" }
tags:
- User
externalDocs:
url: https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/docs/
@@ -103,6 +203,31 @@ components:
type: string
password:
type: string
UserResponse:
type: object
properties:
id:
type: number
username:
type: string
status:
type: number
email:
type: string
image:
type: string
nullable: true
isAdmin:
type: boolean
UserUpdateRequest:
type: object
properties:
username:
type: string
password:
type: string
image:
type: string
securitySchemes:
BasicAuth:
type: apiKey
@@ -110,5 +235,4 @@ components:
in: header
tags:
- name: Login/Logout
- name: Users
- name: Posts
- name: User
File diff suppressed because one or more lines are too long