Skip to content

Commit

Permalink
Merge pull request #22 from alexferl/update_schema
Browse files Browse the repository at this point in the history
update schema
  • Loading branch information
alexferl authored Mar 15, 2024
2 parents 9466eca + 36be7c0 commit 1a0be84
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 13 deletions.
3 changes: 1 addition & 2 deletions models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type UserResponse struct {
Id string `json:"id"`
Bio string `json:"bio"`
CreatedAt *time.Time `json:"created_at"`
Email string `json:"email"`
Email string `json:"email,omitempty"`
Name string `json:"name"`
Roles []string `json:"-"`
UpdatedAt *time.Time `json:"updated_at"`
Expand Down Expand Up @@ -138,7 +138,6 @@ func (u *User) AdminResponse() *UserAdminResponse {
Id: u.Id,
Bio: u.Bio,
CreatedAt: u.CreatedAt,
Email: u.Email,
Name: u.Name,
UpdatedAt: u.UpdatedAt,
Username: u.Username,
Expand Down
1 change: 0 additions & 1 deletion openapi/components/schemas/users/User.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ required:
- id
- bio
- created_at
- email
- is_banned
- is_locked
- name
Expand Down
2 changes: 1 addition & 1 deletion openapi/paths/users/users.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
get:
summary: List users
description: Returns a list of users. Admin role required.
description: Returns a list of users. Admin or higher role required.
operationId: listUsers
security:
- cookieAuth: []
Expand Down
6 changes: 3 additions & 3 deletions openapi/paths/users/{username}.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
get:
summary: Get a user
description: Returns a single user.
description: Returns a single user. Admin or higher role will return more fields.
operationId: getUser
security:
- cookieAuth: []
Expand All @@ -20,15 +20,15 @@ get:
application/json:
schema:
oneOf:
- $ref: '../../components/schemas/users/User.yaml'
- $ref: '../../components/schemas/users/me/CurrentUser.yaml'
- $ref: '../../components/schemas/users/User.yaml'
'401':
$ref: '../../components/responses/Unauthorized.yaml'
'410':
$ref: '../../components/responses/Gone.yaml'
patch:
summary: Update user
description: Returns the updated user.
description: Returns the updated user. Admin or higher role required.
operationId: updateUser
security:
- cookieAuth: []
Expand Down
4 changes: 2 additions & 2 deletions openapi/paths/users/{username}_ban.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
put:
summary: Ban a user
description: Bans a user.
description: Bans a user. Admin or higher role required.
operationId: banUser
security:
- cookieAuth: []
Expand All @@ -26,7 +26,7 @@ put:
$ref: '../../components/responses/Gone.yaml'
delete:
summary: Unban a user
description: Unbans a user.
description: Unbans a user. Admin or higher role required.
operationId: unbanUser
security:
- cookieAuth: []
Expand Down
4 changes: 2 additions & 2 deletions openapi/paths/users/{username}_lock.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
put:
summary: Lock a user
description: Locks a user.
description: Locks a user. Admin or higher role required.
operationId: lockUser
security:
- cookieAuth: []
Expand All @@ -26,7 +26,7 @@ put:
$ref: '../../components/responses/Gone.yaml'
delete:
summary: Unlock a user
description: Unlocks a user.
description: Unlocks a user. Admin or higher role required.
operationId: unlockUser
security:
- cookieAuth: []
Expand Down
4 changes: 2 additions & 2 deletions openapi/paths/users/{username}_roles_{role}.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
put:
summary: Add user role
description: Adds a role to the user.
description: Adds a role to the user. Admin or higher role required.
operationId: addRole
security:
- cookieAuth: []
Expand Down Expand Up @@ -34,7 +34,7 @@ put:
$ref: '../../components/responses/UnprocessableEntity.yaml'
delete:
summary: Remove user role
description: Removes a role from the user.
description: Removes a role from the user. Admin or higher role required.
operationId: removeRole
security:
- cookieAuth: []
Expand Down

0 comments on commit 1a0be84

Please sign in to comment.