Skip to content

Commit

Permalink
add 401, 403 to admin routes
Browse files Browse the repository at this point in the history
  • Loading branch information
kevintsoii committed Oct 11, 2024
1 parent 2814c36 commit 19820b1
Showing 1 changed file with 166 additions and 5 deletions.
171 changes: 166 additions & 5 deletions server/docs/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ paths:
/users:
get:
summary: Admin List all users
description: |
Only available for admin users. Returns a list of all users.
tags:
- users
responses:
Expand All @@ -46,6 +48,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/User'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
put:
summary: Update current user
tags:
Expand All @@ -63,10 +71,18 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/User'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

/users/{userId}:
get:
summary: Admin Get a user by ID
description: |
Only available for admin users. Returns the user info of a user ID.
tags:
- users
parameters:
Expand All @@ -82,8 +98,22 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/User'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
put:
summary: Admin Update a user
description: |
Only available for admin users. Updates a user by user ID.
tags:
- users
parameters:
Expand All @@ -105,8 +135,22 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/User'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
summary: Admin Delete a user
description: |
Only available for admin users. Deletes a user by user ID.
tags:
- users
parameters:
Expand Down Expand Up @@ -134,6 +178,18 @@ paths:
properties:
status:
type: string
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

/subscriptions:
get:
Expand Down Expand Up @@ -176,6 +232,12 @@ paths:
properties:
status:
type: string
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

delete:
summary: User unsubscribes to a company or an event
Expand Down Expand Up @@ -203,6 +265,12 @@ paths:
properties:
status:
type: string
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

/events:
get:
Expand All @@ -219,7 +287,9 @@ paths:
items:
$ref: '#/components/schemas/Event'
post:
summary: Create a new event
summary: Admin Create a new event
description: |
Only available for admin users. Creates a new event.
tags:
- events
requestBody:
Expand All @@ -235,6 +305,18 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Event'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

/events/{eventId}:
get:
Expand All @@ -254,6 +336,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Event'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

/projects:
get:
Expand All @@ -270,7 +358,9 @@ paths:
items:
$ref: '#/components/schemas/Project'
post:
summary: Create a new project
summary: Admin Create a new project
description: |
Only available for admin users. Creates a new project.
tags:
- projects
requestBody:
Expand All @@ -286,10 +376,24 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Project'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

/equipment-rentals:
get:
summary: List all equipment rentals
summary: Admin List all equipment rentals
description: |
Only available for admin users. Returns a list of all equipment rentals.
tags:
- equipment
responses:
Expand All @@ -301,6 +405,18 @@ paths:
type: array
items:
$ref: '#/components/schemas/EquipmentRental'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
summary: Create a new equipment rental
tags:
Expand All @@ -318,6 +434,12 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/EquipmentRental'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

/companies:
get:
Expand All @@ -334,7 +456,9 @@ paths:
items:
$ref: '#/components/schemas/Company'
post:
summary: Create a new company
summary: Admin Create a new company
description: |
Only available for admin users. Creates a new company.
tags:
- company
requestBody:
Expand All @@ -350,10 +474,24 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Company'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

/membership-requests:
get:
summary: List all membership requests
summary: Admin List all membership requests
description: |
Only available for admin users. Returns a list of all membership requests.
tags:
- membership
responses:
Expand All @@ -365,6 +503,18 @@ paths:
type: array
items:
$ref: '#/components/schemas/MembershipRequest'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
summary: Create a new membership request
tags:
Expand All @@ -382,9 +532,20 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/MembershipRequest'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

components:
schemas:
Error:
type: object
properties:
error:
type: string
User:
type: object
properties:
Expand Down

0 comments on commit 19820b1

Please sign in to comment.