Add permission and user admin modules with updated user schema
Split user name into first_name/last_name/name and rename phone_number to phone; add permissions table and register the new permission/user handlers.
This commit is contained in:
984
docs/docs.go
984
docs/docs.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -239,6 +239,32 @@ definitions:
|
||||
- price
|
||||
- title
|
||||
type: object
|
||||
permission.CreatePermissionDTO:
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
guardName:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- code
|
||||
- guardName
|
||||
- name
|
||||
type: object
|
||||
permission.UpdatePermissionDTO:
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
guardName:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- code
|
||||
- guardName
|
||||
- name
|
||||
type: object
|
||||
province.CreateProvinceDTO:
|
||||
properties:
|
||||
active:
|
||||
@@ -309,6 +335,94 @@ definitions:
|
||||
- price
|
||||
- title
|
||||
type: object
|
||||
role.CreateRoleDTO:
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
guardName:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- code
|
||||
- guardName
|
||||
- name
|
||||
type: object
|
||||
role.UpdateRoleDTO:
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
guardName:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- code
|
||||
- guardName
|
||||
- name
|
||||
type: object
|
||||
user.CreateUserDTO:
|
||||
properties:
|
||||
active:
|
||||
type: boolean
|
||||
avatar:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
fullname:
|
||||
type: string
|
||||
lightMode:
|
||||
type: integer
|
||||
password:
|
||||
type: string
|
||||
phoneNumber:
|
||||
type: string
|
||||
role:
|
||||
type: string
|
||||
socialMedia:
|
||||
$ref: '#/definitions/user.SocialMedia'
|
||||
username:
|
||||
type: string
|
||||
required:
|
||||
- email
|
||||
- fullname
|
||||
- password
|
||||
- username
|
||||
type: object
|
||||
user.SocialMedia:
|
||||
properties:
|
||||
facebook:
|
||||
type: string
|
||||
instagram:
|
||||
type: string
|
||||
telegram:
|
||||
type: string
|
||||
type: object
|
||||
user.UpdateUserDTO:
|
||||
properties:
|
||||
active:
|
||||
type: boolean
|
||||
avatar:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
fullname:
|
||||
type: string
|
||||
lightMode:
|
||||
type: integer
|
||||
phoneNumber:
|
||||
type: string
|
||||
role:
|
||||
type: string
|
||||
socialMedia:
|
||||
$ref: '#/definitions/user.SocialMedia'
|
||||
username:
|
||||
type: string
|
||||
required:
|
||||
- email
|
||||
- fullname
|
||||
- username
|
||||
type: object
|
||||
host: localhost:5050
|
||||
info:
|
||||
contact: {}
|
||||
@@ -1144,6 +1258,180 @@ paths:
|
||||
summary: Update payment card active
|
||||
tags:
|
||||
- payment-card
|
||||
/permissions:
|
||||
get:
|
||||
description: Returns paginated permissions with optional filters
|
||||
parameters:
|
||||
- description: Filter by name
|
||||
in: query
|
||||
name: permission_name
|
||||
type: string
|
||||
- default: 1
|
||||
description: Page number
|
||||
in: query
|
||||
name: page
|
||||
type: integer
|
||||
- default: 10
|
||||
description: Items per page
|
||||
in: query
|
||||
name: limit
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: List permissions
|
||||
tags:
|
||||
- permission
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a new permission
|
||||
parameters:
|
||||
- description: Permission payload
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/permission.CreatePermissionDTO'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Create permission
|
||||
tags:
|
||||
- permission
|
||||
/permissions/{id}:
|
||||
delete:
|
||||
description: Deletes a permission
|
||||
parameters:
|
||||
- description: Permission ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Delete permission
|
||||
tags:
|
||||
- permission
|
||||
get:
|
||||
description: Returns a single permission
|
||||
parameters:
|
||||
- description: Permission ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Get permission by ID
|
||||
tags:
|
||||
- permission
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Updates an existing permission
|
||||
parameters:
|
||||
- description: Permission ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: Permission payload
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/permission.UpdatePermissionDTO'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Update permission
|
||||
tags:
|
||||
- permission
|
||||
/profile:
|
||||
get:
|
||||
description: Returns the authenticated user's profile
|
||||
@@ -1504,6 +1792,180 @@ paths:
|
||||
summary: Update reason card
|
||||
tags:
|
||||
- reason-card
|
||||
/roles:
|
||||
get:
|
||||
description: Returns paginated roles with optional filters
|
||||
parameters:
|
||||
- description: Filter by name
|
||||
in: query
|
||||
name: role_name
|
||||
type: string
|
||||
- default: 1
|
||||
description: Page number
|
||||
in: query
|
||||
name: page
|
||||
type: integer
|
||||
- default: 10
|
||||
description: Items per page
|
||||
in: query
|
||||
name: limit
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: List roles
|
||||
tags:
|
||||
- role
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a new role
|
||||
parameters:
|
||||
- description: Role payload
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/role.CreateRoleDTO'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Create role
|
||||
tags:
|
||||
- role
|
||||
/roles/{id}:
|
||||
delete:
|
||||
description: Deletes a role
|
||||
parameters:
|
||||
- description: Role ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Delete role
|
||||
tags:
|
||||
- role
|
||||
get:
|
||||
description: Returns a single role
|
||||
parameters:
|
||||
- description: Role ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Get role by ID
|
||||
tags:
|
||||
- role
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Updates an existing role
|
||||
parameters:
|
||||
- description: Role ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: Role payload
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/role.UpdateRoleDTO'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Update role
|
||||
tags:
|
||||
- role
|
||||
/token:
|
||||
post:
|
||||
consumes:
|
||||
@@ -1534,6 +1996,180 @@ paths:
|
||||
summary: Refresh tokens
|
||||
tags:
|
||||
- auth
|
||||
/users:
|
||||
get:
|
||||
description: Returns paginated users with optional filters
|
||||
parameters:
|
||||
- description: Filter by username
|
||||
in: query
|
||||
name: username
|
||||
type: string
|
||||
- default: 1
|
||||
description: Page number
|
||||
in: query
|
||||
name: page
|
||||
type: integer
|
||||
- default: 10
|
||||
description: Items per page
|
||||
in: query
|
||||
name: limit
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: List users
|
||||
tags:
|
||||
- user
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a new user
|
||||
parameters:
|
||||
- description: User payload
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/user.CreateUserDTO'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Create user
|
||||
tags:
|
||||
- user
|
||||
/users/{id}:
|
||||
delete:
|
||||
description: Deletes a user
|
||||
parameters:
|
||||
- description: User ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Delete user
|
||||
tags:
|
||||
- user
|
||||
get:
|
||||
description: Returns a single user
|
||||
parameters:
|
||||
- description: User ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Get user by ID
|
||||
tags:
|
||||
- user
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Updates an existing user
|
||||
parameters:
|
||||
- description: User ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
- description: User payload
|
||||
in: body
|
||||
name: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/user.UpdateUserDTO'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppSuccess'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/appresult.AppError'
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: Update user
|
||||
tags:
|
||||
- user
|
||||
securityDefinitions:
|
||||
BearerAuth:
|
||||
in: header
|
||||
|
||||
Reference in New Issue
Block a user