Refactor User Management API and Update Documentation

- Changed API tags from "Admin-Users" to "Admin-Authorization" for better clarity in user management endpoints.
- Removed unused endpoints for retrieving users by company ID and role, streamlining the user management functionality.
- Updated user entity and forms to reflect new example values for improved clarity in API documentation.
- Enhanced pagination handling in user listing responses, ensuring consistent metadata structure.
- Updated API documentation to reflect changes in endpoint structure and response formats, improving clarity for API consumers.
This commit is contained in:
n.nakhostin
2025-09-06 14:00:22 +03:30
parent eb69a842f0
commit 38844939b5
11 changed files with 567 additions and 1734 deletions
+25 -315
View File
@@ -3455,7 +3455,7 @@ const docTemplate = `{
"application/json"
],
"tags": [
"Admin-Users"
"Admin-Authorization"
],
"summary": "Get authenticated user profile",
"responses": {
@@ -3511,7 +3511,7 @@ const docTemplate = `{
"application/json"
],
"tags": [
"Admin-Users"
"Admin-Authorization"
],
"summary": "Update authenticated user profile",
"parameters": [
@@ -3592,7 +3592,7 @@ const docTemplate = `{
"application/json"
],
"tags": [
"Admin-Users"
"Admin-Authorization"
],
"summary": "Change user password",
"parameters": [
@@ -4353,12 +4353,6 @@ const docTemplate = `{
"name": "role",
"in": "query"
},
{
"type": "string",
"description": "Company ID filter",
"name": "company_id",
"in": "query"
},
{
"type": "integer",
"description": "Limit results",
@@ -4515,178 +4509,6 @@ const docTemplate = `{
}
}
},
"/admin/v1/users/company/{company_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get users belonging to a specific company (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Users"
],
"summary": "Get users by company ID",
"parameters": [
{
"type": "string",
"description": "Company ID",
"name": "company_id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "Limit results",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Offset results",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "Users with pagination metadata",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "object",
"additionalProperties": true
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/admin/v1/users/role/{role}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get users with a specific role (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Users"
],
"summary": "Get users by role",
"parameters": [
{
"type": "string",
"description": "User role",
"name": "role",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "Limit results",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Offset results",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "Users with pagination metadata",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "object",
"additionalProperties": true
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/admin/v1/users/{id}": {
"get": {
"security": [
@@ -4917,82 +4739,6 @@ const docTemplate = `{
}
}
},
"/admin/v1/users/{id}/role": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update user role (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Users"
],
"summary": "Update user role",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Role update data",
"name": "role",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.UpdateUserRoleForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/admin/v1/users/{id}/status": {
"put": {
"security": [
@@ -8301,12 +8047,12 @@ const docTemplate = `{
"new_password": {
"description": "New password (minimum 8 characters)",
"type": "string",
"example": "NewPass456!"
"example": "NewAdmin!1234"
},
"old_password": {
"description": "Current password for verification",
"type": "string",
"example": "OldPassword123!"
"example": "Admin!1234"
}
}
},
@@ -8321,42 +8067,42 @@ const docTemplate = `{
"email": {
"description": "Valid email address",
"type": "string",
"example": "john.smith@company.com"
"example": "admin@opplens.com"
},
"full_name": {
"description": "Full name of the user",
"type": "string",
"example": "John Smith"
"example": "Admin User"
},
"password": {
"description": "Password (minimum 8 characters)",
"type": "string",
"example": "SecurePass123!"
"example": "Admin!1234"
},
"phone": {
"description": "Optional phone number",
"type": "string",
"example": "+1234567890"
"example": "+18289784438"
},
"position": {
"description": "Optional job position",
"type": "string",
"example": "Senior Developer"
"example": "Lead"
},
"profile_image": {
"description": "Optional profile image URL",
"type": "string",
"example": "https://example.com/avatar.jpg"
"example": ""
},
"role": {
"description": "User role (admin, manager, operator, viewer)",
"type": "string",
"example": "manager"
"example": "admin"
},
"username": {
"description": "Unique username (alphanumeric only)",
"type": "string",
"example": "johnsmith"
"example": "admin"
}
}
},
@@ -8366,12 +8112,12 @@ const docTemplate = `{
"password": {
"description": "User password",
"type": "string",
"example": "Nima.1998"
"example": "Admin!1234"
},
"username": {
"description": "Username or email address",
"type": "string",
"example": "nakhostin"
"example": "admin"
}
}
},
@@ -8391,70 +8137,52 @@ const docTemplate = `{
"email": {
"description": "Email address for password reset",
"type": "string",
"example": "john.smith@company.com"
"example": "admin@opplens.com"
}
}
},
"user.UpdateUserForm": {
"type": "object",
"properties": {
"company_id": {
"description": "Updated company ID",
"type": "string",
"example": "123e4567-e89b-12d3-a456-426614174000"
},
"department": {
"description": "Updated department",
"type": "string",
"example": "Product Management"
"example": "Information Technology"
},
"email": {
"description": "Updated email address",
"type": "string",
"example": "john.smith@newcompany.com"
"example": "admin@opplens.com"
},
"full_name": {
"description": "Updated full name",
"type": "string",
"example": "John Smith"
"example": "Admin User"
},
"phone": {
"description": "Updated phone number",
"type": "string",
"example": "+1234567890"
"example": "+18289784438"
},
"position": {
"description": "Updated position",
"type": "string",
"example": "Tech Lead"
"example": "Lead"
},
"profile_image": {
"description": "Updated profile image URL",
"type": "string",
"example": "https://example.com/new-avatar.jpg"
"example": ""
},
"role": {
"description": "Updated user role",
"type": "string",
"example": "admin"
},
"status": {
"description": "Updated account status",
"type": "string",
"example": "active"
},
"username": {
"description": "Updated username",
"type": "string",
"example": "johnsmith"
}
}
},
"user.UpdateUserRoleForm": {
"type": "object",
"properties": {
"role": {
"type": "string"
"example": "admin"
}
}
},
@@ -8469,17 +8197,8 @@ const docTemplate = `{
"user.UserListResponse": {
"type": "object",
"properties": {
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"total": {
"type": "integer"
},
"total_pages": {
"type": "integer"
"meta": {
"$ref": "#/definitions/response.Meta"
},
"users": {
"type": "array",
@@ -8492,15 +8211,9 @@ const docTemplate = `{
"user.UserResponse": {
"type": "object",
"properties": {
"company_id": {
"type": "string"
},
"created_at": {
"type": "integer"
},
"created_by": {
"type": "string"
},
"department": {
"type": "string"
},
@@ -8537,9 +8250,6 @@ const docTemplate = `{
"updated_at": {
"type": "integer"
},
"updated_by": {
"type": "string"
},
"username": {
"type": "string"
}
+25 -315
View File
@@ -3449,7 +3449,7 @@
"application/json"
],
"tags": [
"Admin-Users"
"Admin-Authorization"
],
"summary": "Get authenticated user profile",
"responses": {
@@ -3505,7 +3505,7 @@
"application/json"
],
"tags": [
"Admin-Users"
"Admin-Authorization"
],
"summary": "Update authenticated user profile",
"parameters": [
@@ -3586,7 +3586,7 @@
"application/json"
],
"tags": [
"Admin-Users"
"Admin-Authorization"
],
"summary": "Change user password",
"parameters": [
@@ -4347,12 +4347,6 @@
"name": "role",
"in": "query"
},
{
"type": "string",
"description": "Company ID filter",
"name": "company_id",
"in": "query"
},
{
"type": "integer",
"description": "Limit results",
@@ -4509,178 +4503,6 @@
}
}
},
"/admin/v1/users/company/{company_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get users belonging to a specific company (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Users"
],
"summary": "Get users by company ID",
"parameters": [
{
"type": "string",
"description": "Company ID",
"name": "company_id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "Limit results",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Offset results",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "Users with pagination metadata",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "object",
"additionalProperties": true
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/admin/v1/users/role/{role}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get users with a specific role (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Users"
],
"summary": "Get users by role",
"parameters": [
{
"type": "string",
"description": "User role",
"name": "role",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "Limit results",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Offset results",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "Users with pagination metadata",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "object",
"additionalProperties": true
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/admin/v1/users/{id}": {
"get": {
"security": [
@@ -4911,82 +4733,6 @@
}
}
},
"/admin/v1/users/{id}/role": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update user role (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Users"
],
"summary": "Update user role",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Role update data",
"name": "role",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.UpdateUserRoleForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/admin/v1/users/{id}/status": {
"put": {
"security": [
@@ -8295,12 +8041,12 @@
"new_password": {
"description": "New password (minimum 8 characters)",
"type": "string",
"example": "NewPass456!"
"example": "NewAdmin!1234"
},
"old_password": {
"description": "Current password for verification",
"type": "string",
"example": "OldPassword123!"
"example": "Admin!1234"
}
}
},
@@ -8315,42 +8061,42 @@
"email": {
"description": "Valid email address",
"type": "string",
"example": "john.smith@company.com"
"example": "admin@opplens.com"
},
"full_name": {
"description": "Full name of the user",
"type": "string",
"example": "John Smith"
"example": "Admin User"
},
"password": {
"description": "Password (minimum 8 characters)",
"type": "string",
"example": "SecurePass123!"
"example": "Admin!1234"
},
"phone": {
"description": "Optional phone number",
"type": "string",
"example": "+1234567890"
"example": "+18289784438"
},
"position": {
"description": "Optional job position",
"type": "string",
"example": "Senior Developer"
"example": "Lead"
},
"profile_image": {
"description": "Optional profile image URL",
"type": "string",
"example": "https://example.com/avatar.jpg"
"example": ""
},
"role": {
"description": "User role (admin, manager, operator, viewer)",
"type": "string",
"example": "manager"
"example": "admin"
},
"username": {
"description": "Unique username (alphanumeric only)",
"type": "string",
"example": "johnsmith"
"example": "admin"
}
}
},
@@ -8360,12 +8106,12 @@
"password": {
"description": "User password",
"type": "string",
"example": "Nima.1998"
"example": "Admin!1234"
},
"username": {
"description": "Username or email address",
"type": "string",
"example": "nakhostin"
"example": "admin"
}
}
},
@@ -8385,70 +8131,52 @@
"email": {
"description": "Email address for password reset",
"type": "string",
"example": "john.smith@company.com"
"example": "admin@opplens.com"
}
}
},
"user.UpdateUserForm": {
"type": "object",
"properties": {
"company_id": {
"description": "Updated company ID",
"type": "string",
"example": "123e4567-e89b-12d3-a456-426614174000"
},
"department": {
"description": "Updated department",
"type": "string",
"example": "Product Management"
"example": "Information Technology"
},
"email": {
"description": "Updated email address",
"type": "string",
"example": "john.smith@newcompany.com"
"example": "admin@opplens.com"
},
"full_name": {
"description": "Updated full name",
"type": "string",
"example": "John Smith"
"example": "Admin User"
},
"phone": {
"description": "Updated phone number",
"type": "string",
"example": "+1234567890"
"example": "+18289784438"
},
"position": {
"description": "Updated position",
"type": "string",
"example": "Tech Lead"
"example": "Lead"
},
"profile_image": {
"description": "Updated profile image URL",
"type": "string",
"example": "https://example.com/new-avatar.jpg"
"example": ""
},
"role": {
"description": "Updated user role",
"type": "string",
"example": "admin"
},
"status": {
"description": "Updated account status",
"type": "string",
"example": "active"
},
"username": {
"description": "Updated username",
"type": "string",
"example": "johnsmith"
}
}
},
"user.UpdateUserRoleForm": {
"type": "object",
"properties": {
"role": {
"type": "string"
"example": "admin"
}
}
},
@@ -8463,17 +8191,8 @@
"user.UserListResponse": {
"type": "object",
"properties": {
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"total": {
"type": "integer"
},
"total_pages": {
"type": "integer"
"meta": {
"$ref": "#/definitions/response.Meta"
},
"users": {
"type": "array",
@@ -8486,15 +8205,9 @@
"user.UserResponse": {
"type": "object",
"properties": {
"company_id": {
"type": "string"
},
"created_at": {
"type": "integer"
},
"created_by": {
"type": "string"
},
"department": {
"type": "string"
},
@@ -8531,9 +8244,6 @@
"updated_at": {
"type": "integer"
},
"updated_by": {
"type": "string"
},
"username": {
"type": "string"
}
+25 -209
View File
@@ -1121,11 +1121,11 @@ definitions:
properties:
new_password:
description: New password (minimum 8 characters)
example: NewPass456!
example: NewAdmin!1234
type: string
old_password:
description: Current password for verification
example: OldPassword123!
example: Admin!1234
type: string
type: object
user.CreateUserForm:
@@ -1136,46 +1136,46 @@ definitions:
type: string
email:
description: Valid email address
example: john.smith@company.com
example: admin@opplens.com
type: string
full_name:
description: Full name of the user
example: John Smith
example: Admin User
type: string
password:
description: Password (minimum 8 characters)
example: SecurePass123!
example: Admin!1234
type: string
phone:
description: Optional phone number
example: "+1234567890"
example: "+18289784438"
type: string
position:
description: Optional job position
example: Senior Developer
example: Lead
type: string
profile_image:
description: Optional profile image URL
example: https://example.com/avatar.jpg
example: ""
type: string
role:
description: User role (admin, manager, operator, viewer)
example: manager
example: admin
type: string
username:
description: Unique username (alphanumeric only)
example: johnsmith
example: admin
type: string
type: object
user.LoginForm:
properties:
password:
description: User password
example: Nima.1998
example: Admin!1234
type: string
username:
description: Username or email address
example: nakhostin
example: admin
type: string
type: object
user.RefreshTokenForm:
@@ -1189,55 +1189,42 @@ definitions:
properties:
email:
description: Email address for password reset
example: john.smith@company.com
example: admin@opplens.com
type: string
type: object
user.UpdateUserForm:
properties:
company_id:
description: Updated company ID
example: 123e4567-e89b-12d3-a456-426614174000
type: string
department:
description: Updated department
example: Product Management
example: Information Technology
type: string
email:
description: Updated email address
example: john.smith@newcompany.com
example: admin@opplens.com
type: string
full_name:
description: Updated full name
example: John Smith
example: Admin User
type: string
phone:
description: Updated phone number
example: "+1234567890"
example: "+18289784438"
type: string
position:
description: Updated position
example: Tech Lead
example: Lead
type: string
profile_image:
description: Updated profile image URL
example: https://example.com/new-avatar.jpg
example: ""
type: string
role:
description: Updated user role
example: admin
type: string
status:
description: Updated account status
example: active
type: string
username:
description: Updated username
example: johnsmith
type: string
type: object
user.UpdateUserRoleForm:
properties:
role:
example: admin
type: string
type: object
user.UpdateUserStatusForm:
@@ -1247,14 +1234,8 @@ definitions:
type: object
user.UserListResponse:
properties:
limit:
type: integer
offset:
type: integer
total:
type: integer
total_pages:
type: integer
meta:
$ref: '#/definitions/response.Meta'
users:
items:
$ref: '#/definitions/user.UserResponse'
@@ -1262,12 +1243,8 @@ definitions:
type: object
user.UserResponse:
properties:
company_id:
type: string
created_at:
type: integer
created_by:
type: string
department:
type: string
email:
@@ -1292,8 +1269,6 @@ definitions:
type: string
updated_at:
type: integer
updated_by:
type: string
username:
type: string
type: object
@@ -3521,7 +3496,7 @@ paths:
- BearerAuth: []
summary: Get authenticated user profile
tags:
- Admin-Users
- Admin-Authorization
put:
consumes:
- application/json
@@ -3572,7 +3547,7 @@ paths:
- BearerAuth: []
summary: Update authenticated user profile
tags:
- Admin-Users
- Admin-Authorization
/admin/v1/profile/change-password:
put:
consumes:
@@ -3616,7 +3591,7 @@ paths:
- BearerAuth: []
summary: Change user password
tags:
- Admin-Users
- Admin-Authorization
/admin/v1/profile/login:
post:
consumes:
@@ -4070,10 +4045,6 @@ paths:
in: query
name: role
type: string
- description: Company ID filter
in: query
name: company_id
type: string
- description: Limit results
in: query
name: limit
@@ -4322,55 +4293,6 @@ paths:
summary: Update user
tags:
- Admin-Users
/admin/v1/users/{id}/role:
put:
consumes:
- application/json
description: Update user role (admin only)
parameters:
- description: User ID
in: path
name: id
required: true
type: string
- description: Role update data
in: body
name: role
required: true
schema:
$ref: '#/definitions/user.UpdateUserRoleForm'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/response.APIResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.APIResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/response.APIResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Update user role
tags:
- Admin-Users
/admin/v1/users/{id}/status:
put:
consumes:
@@ -4420,112 +4342,6 @@ paths:
summary: Update user status
tags:
- Admin-Users
/admin/v1/users/company/{company_id}:
get:
consumes:
- application/json
description: Get users belonging to a specific company (admin only)
parameters:
- description: Company ID
in: path
name: company_id
required: true
type: string
- description: Limit results
in: query
name: limit
type: integer
- description: Offset results
in: query
name: offset
type: integer
produces:
- application/json
responses:
"200":
description: Users with pagination metadata
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
additionalProperties: true
type: object
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.APIResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get users by company ID
tags:
- Admin-Users
/admin/v1/users/role/{role}:
get:
consumes:
- application/json
description: Get users with a specific role (admin only)
parameters:
- description: User role
in: path
name: role
required: true
type: string
- description: Limit results
in: query
name: limit
type: integer
- description: Offset results
in: query
name: offset
type: integer
produces:
- application/json
responses:
"200":
description: Users with pagination metadata
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
additionalProperties: true
type: object
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.APIResponse'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.APIResponse'
"403":
description: Forbidden
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get users by role
tags:
- Admin-Users
/api/v1/companies:
get:
consumes:
-3
View File
@@ -24,9 +24,6 @@ func RegisterAdminRoutes(e *echo.Echo, userHandler *user.Handler, companyHandler
adminUsersGP.PUT("/:id", userHandler.UpdateUser)
adminUsersGP.DELETE("/:id", userHandler.DeleteUser)
adminUsersGP.PUT("/:id/status", userHandler.UpdateUserStatus)
adminUsersGP.PUT("/:id/role", userHandler.UpdateUserRole)
adminUsersGP.GET("/company/:company_id", userHandler.GetUsersByCompanyID)
adminUsersGP.GET("/role/:role", userHandler.GetUsersByRole)
}
// Admin user profile