Register endpoint
This commit is contained in:
+68
-18
@@ -28,13 +28,13 @@ paths:
|
||||
Success:
|
||||
value: true
|
||||
400:
|
||||
description: Missing Fields
|
||||
description: Missing fields
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorResponse"
|
||||
examples:
|
||||
Missing Fields:
|
||||
Missing fields:
|
||||
value: { "message": "Missing email" }
|
||||
401:
|
||||
description: Invalid credentials
|
||||
@@ -43,17 +43,17 @@ paths:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorResponse"
|
||||
examples:
|
||||
Invalid Username or Password:
|
||||
value: { "message": "Invalid Username or Password" }
|
||||
Invalid username or password:
|
||||
value: { "message": "Invalid username or password" }
|
||||
404:
|
||||
description: User not Found
|
||||
description: User not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorResponse"
|
||||
examples:
|
||||
User not Found:
|
||||
value: { "message": "User not Found" }
|
||||
User not found:
|
||||
value: { "message": "User not found" }
|
||||
500:
|
||||
description: Failed
|
||||
content:
|
||||
@@ -68,7 +68,7 @@ paths:
|
||||
/logout:
|
||||
post:
|
||||
summary: Logout
|
||||
description: Log out User
|
||||
description: Log out user
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
@@ -83,6 +83,42 @@ paths:
|
||||
value: true
|
||||
tags:
|
||||
- Login/Logout
|
||||
/register:
|
||||
post:
|
||||
summary: Register
|
||||
description: Register a new user
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/RegisterRequest"
|
||||
responses:
|
||||
200:
|
||||
description: Success
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/BooleanResponse"
|
||||
examples:
|
||||
Success:
|
||||
value: true
|
||||
400:
|
||||
description: Missing fields or duplicate
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorResponse"
|
||||
examples:
|
||||
Missing fields:
|
||||
value: { "message": "Missing email" }
|
||||
Duplicate:
|
||||
value:
|
||||
{
|
||||
"message": "A user with this username or email already exists",
|
||||
}
|
||||
tags:
|
||||
- Register
|
||||
/user{id}:
|
||||
get:
|
||||
summary: Get user
|
||||
@@ -116,14 +152,14 @@ paths:
|
||||
"isAdmin": true,
|
||||
}
|
||||
404:
|
||||
description: User not Found
|
||||
description: User not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorResponse"
|
||||
examples:
|
||||
User not Found:
|
||||
value: { "message": "User not Found" }
|
||||
User not found:
|
||||
value: { "message": "User not found" }
|
||||
tags:
|
||||
- User
|
||||
patch:
|
||||
@@ -158,14 +194,14 @@ paths:
|
||||
Success:
|
||||
value: true
|
||||
404:
|
||||
description: User not Found
|
||||
description: User not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorResponse"
|
||||
examples:
|
||||
User not Found:
|
||||
value: { "message": "User not Found" }
|
||||
User not found:
|
||||
value: { "message": "User not found" }
|
||||
500:
|
||||
description: Update failed
|
||||
content:
|
||||
@@ -173,7 +209,7 @@ paths:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorResponse"
|
||||
examples:
|
||||
User not Found:
|
||||
User not found:
|
||||
value: { "message": "Failed to update username" }
|
||||
tags:
|
||||
- User
|
||||
@@ -202,14 +238,14 @@ paths:
|
||||
Success:
|
||||
value: true
|
||||
404:
|
||||
description: User not Found
|
||||
description: User not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ErrorResponse"
|
||||
examples:
|
||||
User not Found:
|
||||
value: { "message": "User not Found" }
|
||||
User not found:
|
||||
value: { "message": "User not found" }
|
||||
tags:
|
||||
- User
|
||||
|
||||
@@ -263,6 +299,19 @@ components:
|
||||
image:
|
||||
type: string
|
||||
format: binary
|
||||
RegisterRequest:
|
||||
type: object
|
||||
required:
|
||||
- username
|
||||
- email
|
||||
- password
|
||||
properties:
|
||||
username:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
securitySchemes:
|
||||
BasicAuth:
|
||||
type: apiKey
|
||||
@@ -270,4 +319,5 @@ components:
|
||||
in: header
|
||||
tags:
|
||||
- name: Login/Logout
|
||||
- name: Register
|
||||
- name: User
|
||||
|
||||
+24
-18
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user