Files
tm_back/cmd/web/docs/docs.go
T
n.nakhostin 98f581ec97 Enhance cursor rules and add user management functionality
- Updated cursor rules to emphasize the importance of dependency injection and logging practices.
- Introduced a new user management domain, including entities, services, handlers, and validation.
- Implemented user authentication features such as login, registration, and role-based access control.
- Added Redis integration for token management and caching.
- Enhanced API documentation with Swagger for user-related endpoints.
- Updated configuration to support new JWT settings and Redis connection parameters.
2025-08-10 14:09:17 +03:30

2509 lines
86 KiB
Go

// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/admin/customers": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Retrieve a paginated list of customers (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"customers"
],
"summary": "List customers",
"parameters": [
{
"type": "integer",
"default": 1,
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 20,
"description": "Number of items per page",
"name": "limit",
"in": "query"
},
{
"type": "string",
"description": "Search term",
"name": "search",
"in": "query"
}
],
"responses": {
"200": {
"description": "Customers retrieved successfully",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/customer.CustomerResponse"
}
}
}
}
]
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/admin/customers/device-tokens": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Retrieve all device tokens (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"customers"
],
"summary": "Get all device tokens",
"responses": {
"200": {
"description": "Device tokens retrieved successfully",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
]
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/admin/customers/register": {
"post": {
"description": "Register a new customer with the provided information",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"customers"
],
"summary": "Register a new customer",
"parameters": [
{
"description": "Customer registration information",
"name": "customer",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/customer.RegisterCustomerForm"
}
}
],
"responses": {
"201": {
"description": "Customer registered successfully",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/customer.CustomerResponse"
}
}
}
]
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"409": {
"description": "Customer already exists",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/admin/customers/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Retrieve customer information by ID (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"customers"
],
"summary": "Get customer by ID",
"parameters": [
{
"type": "string",
"description": "Customer ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Customer retrieved successfully",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/customer.CustomerResponse"
}
}
}
]
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"404": {
"description": "Customer not found",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/admin/customers/{id}/status": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update customer status (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"customers"
],
"summary": "Update customer status",
"parameters": [
{
"type": "string",
"description": "Customer ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Status update information",
"name": "status",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/customer.UpdateCustomerStatusForm"
}
}
],
"responses": {
"200": {
"description": "Customer status updated successfully",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"404": {
"description": "Customer not found",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/customers/change-password": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Change the authenticated customer's password",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"customers"
],
"summary": "Change customer password",
"parameters": [
{
"description": "Password change information",
"name": "password",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/customer.ChangePasswordForm"
}
}
],
"responses": {
"200": {
"description": "Password changed successfully",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/customers/device-token": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Add a device token for push notifications",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"customers"
],
"summary": "Add device token",
"parameters": [
{
"description": "Device token information",
"name": "device_token",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/customer.AddDeviceTokenForm"
}
}
],
"responses": {
"200": {
"description": "Device token added successfully",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Remove a device token for push notifications",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"customers"
],
"summary": "Remove device token",
"parameters": [
{
"description": "Device token information",
"name": "device_token",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/customer.RemoveDeviceTokenForm"
}
}
],
"responses": {
"200": {
"description": "Device token removed successfully",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/customers/login": {
"post": {
"description": "Authenticate customer with email and password",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"customers"
],
"summary": "Customer login",
"parameters": [
{
"description": "Login credentials",
"name": "credentials",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/customer.LoginForm"
}
}
],
"responses": {
"200": {
"description": "Login successful",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/customer.AuthResponse"
}
}
}
]
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Invalid credentials",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/customers/logout": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Logout customer and invalidate device token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"customers"
],
"summary": "Customer logout",
"parameters": [
{
"description": "Logout request with device token",
"name": "logout",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
}
],
"responses": {
"200": {
"description": "Logged out successfully",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/customers/profile": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Retrieve the authenticated customer's profile information",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"customers"
],
"summary": "Get customer profile",
"responses": {
"200": {
"description": "Profile retrieved successfully",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/customer.CustomerResponse"
}
}
}
]
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"404": {
"description": "Customer not found",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update the authenticated customer's profile information",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"customers"
],
"summary": "Update customer profile",
"parameters": [
{
"description": "Profile update information",
"name": "profile",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/customer.UpdateCustomerForm"
}
}
],
"responses": {
"200": {
"description": "Profile updated successfully",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/customer.CustomerResponse"
}
}
}
]
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/customers/refresh-token": {
"post": {
"description": "Refresh the access token using a refresh token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"customers"
],
"summary": "Refresh access token",
"parameters": [
{
"description": "Refresh token information",
"name": "token",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/customer.RefreshTokenForm"
}
}
],
"responses": {
"200": {
"description": "Token refreshed successfully",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/customer.AuthResponse"
}
}
}
]
}
},
"400": {
"description": "Bad request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Invalid refresh token",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/users/admin": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "List users with search and filters (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "List users",
"parameters": [
{
"type": "string",
"description": "Search term",
"name": "search",
"in": "query"
},
{
"type": "string",
"description": "User status filter",
"name": "status",
"in": "query"
},
{
"type": "string",
"description": "User role filter",
"name": "role",
"in": "query"
},
{
"type": "string",
"description": "Company ID filter",
"name": "company_id",
"in": "query"
},
{
"type": "integer",
"description": "Limit results",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Offset results",
"name": "offset",
"in": "query"
},
{
"type": "string",
"description": "Sort field",
"name": "sort_by",
"in": "query"
},
{
"type": "string",
"description": "Sort order",
"name": "sort_order",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/user.UserListResponse"
}
}
}
]
}
},
"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"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Create a new user (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Create user",
"parameters": [
{
"description": "User creation data",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.CreateUserForm"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/user.UserResponse"
}
}
}
]
}
},
"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"
}
}
}
}
},
"/users/admin/company/{company_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get users belonging to a specific company (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"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": "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"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/users/admin/role/{role}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get users with a specific role (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"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": "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"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/users/admin/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get user details by ID (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Get user by ID",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/user.UserResponse"
}
}
}
]
}
},
"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"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update user information (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Update user",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "User update data",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.UpdateUserForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/user.UserResponse"
}
}
}
]
}
},
"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"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Delete a user (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Delete user",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
}
],
"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"
}
}
}
}
},
"/users/admin/{id}/role": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update user role (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"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"
}
}
}
}
},
"/users/admin/{id}/status": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update user account status (admin only)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Update user status",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Status update data",
"name": "status",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.UpdateUserStatusForm"
}
}
],
"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"
}
}
}
}
},
"/users/change-password": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Change current user password",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Change password",
"parameters": [
{
"description": "Password change data",
"name": "password",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.ChangePasswordForm"
}
}
],
"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"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/users/login": {
"post": {
"description": "Authenticate user with email/username and password",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Login user",
"parameters": [
{
"description": "Login credentials",
"name": "login",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.LoginForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/user.AuthResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/users/logout": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Logout current user and invalidate tokens",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Logout user",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/users/profile": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get current user profile information",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Get user profile",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/user.UserResponse"
}
}
}
]
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update current user profile information",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Update user profile",
"parameters": [
{
"description": "Profile update data",
"name": "profile",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.UpdateUserForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/user.UserResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/users/refresh-token": {
"post": {
"description": "Refresh access token using refresh token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Refresh access token",
"parameters": [
{
"description": "Refresh token",
"name": "refresh",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.RefreshTokenForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.APIResponse"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/user.AuthResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/users/reset-password": {
"post": {
"description": "Send password reset email to user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Reset password",
"parameters": [
{
"description": "Password reset request",
"name": "reset",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.ResetPasswordForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
}
},
"definitions": {
"customer.AddDeviceTokenForm": {
"type": "object",
"properties": {
"device_token": {
"type": "string"
},
"device_type": {
"type": "string"
}
}
},
"customer.AuthResponse": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"customer": {
"$ref": "#/definitions/customer.CustomerResponse"
},
"expires_at": {
"type": "integer"
},
"refresh_token": {
"type": "string"
}
}
},
"customer.ChangePasswordForm": {
"type": "object",
"properties": {
"new_password": {
"type": "string"
},
"old_password": {
"type": "string"
}
}
},
"customer.CustomerResponse": {
"type": "object",
"properties": {
"birthdate": {
"type": "integer"
},
"company_id": {
"type": "string"
},
"created_at": {
"type": "integer"
},
"device_tokens": {
"type": "array",
"items": {
"$ref": "#/definitions/customer.DeviceToken"
}
},
"email": {
"type": "string"
},
"full_name": {
"type": "string"
},
"gender": {
"type": "string"
},
"id": {
"type": "string"
},
"is_verified": {
"type": "boolean"
},
"last_login_at": {
"type": "integer"
},
"mobile": {
"type": "string"
},
"national_id": {
"type": "string"
},
"profile_image": {
"type": "string"
},
"status": {
"type": "string"
},
"updated_at": {
"type": "integer"
},
"username": {
"type": "string"
}
}
},
"customer.DeviceToken": {
"type": "object",
"properties": {
"createdAt": {
"description": "Unix timestamp",
"type": "integer"
},
"deviceType": {
"$ref": "#/definitions/customer.DeviceType"
},
"token": {
"type": "string"
},
"updatedAt": {
"description": "Unix timestamp",
"type": "integer"
}
}
},
"customer.DeviceType": {
"type": "string",
"enum": [
"android",
"ios"
],
"x-enum-varnames": [
"DeviceTypeAndroid",
"DeviceTypeIOS"
]
},
"customer.LoginForm": {
"type": "object",
"properties": {
"email_or_mobile": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"customer.RefreshTokenForm": {
"type": "object",
"properties": {
"refresh_token": {
"type": "string"
}
}
},
"customer.RegisterCustomerForm": {
"type": "object",
"properties": {
"birthdate": {
"type": "integer"
},
"company_id": {
"type": "string"
},
"email": {
"type": "string"
},
"full_name": {
"type": "string"
},
"gender": {
"type": "string"
},
"mobile": {
"type": "string"
},
"national_id": {
"type": "string"
},
"password": {
"type": "string"
},
"profile_image": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"customer.RemoveDeviceTokenForm": {
"type": "object",
"properties": {
"device_token": {
"type": "string"
}
}
},
"customer.UpdateCustomerForm": {
"type": "object",
"properties": {
"birthdate": {
"type": "integer"
},
"email": {
"type": "string"
},
"full_name": {
"type": "string"
},
"gender": {
"type": "string"
},
"mobile": {
"type": "string"
},
"national_id": {
"type": "string"
},
"profile_image": {
"type": "string"
},
"status": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"customer.UpdateCustomerStatusForm": {
"type": "object",
"properties": {
"status": {
"type": "string"
}
}
},
"response.APIError": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"details": {
"type": "string"
},
"message": {
"type": "string"
}
}
},
"response.APIResponse": {
"type": "object",
"properties": {
"data": {},
"error": {
"$ref": "#/definitions/response.APIError"
},
"message": {
"type": "string"
},
"meta": {
"$ref": "#/definitions/response.Meta"
},
"success": {
"type": "boolean"
}
}
},
"response.Meta": {
"type": "object",
"properties": {
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"page": {
"type": "integer"
},
"pages": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
},
"user.AuthResponse": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"expires_at": {
"type": "integer"
},
"refresh_token": {
"type": "string"
},
"user": {
"$ref": "#/definitions/user.UserResponse"
}
}
},
"user.ChangePasswordForm": {
"type": "object",
"properties": {
"new_password": {
"type": "string"
},
"old_password": {
"type": "string"
}
}
},
"user.CreateUserForm": {
"type": "object",
"properties": {
"company_id": {
"type": "string"
},
"department": {
"type": "string"
},
"email": {
"type": "string"
},
"full_name": {
"type": "string"
},
"password": {
"type": "string"
},
"phone": {
"type": "string"
},
"position": {
"type": "string"
},
"profile_image": {
"type": "string"
},
"role": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"user.LoginForm": {
"type": "object",
"properties": {
"email_or_username": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"user.RefreshTokenForm": {
"type": "object",
"properties": {
"refresh_token": {
"type": "string"
}
}
},
"user.ResetPasswordForm": {
"type": "object",
"properties": {
"email": {
"type": "string"
}
}
},
"user.UpdateUserForm": {
"type": "object",
"properties": {
"company_id": {
"type": "string"
},
"department": {
"type": "string"
},
"email": {
"type": "string"
},
"full_name": {
"type": "string"
},
"phone": {
"type": "string"
},
"position": {
"type": "string"
},
"profile_image": {
"type": "string"
},
"role": {
"type": "string"
},
"status": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"user.UpdateUserRoleForm": {
"type": "object",
"properties": {
"role": {
"type": "string"
}
}
},
"user.UpdateUserStatusForm": {
"type": "object",
"properties": {
"status": {
"type": "string"
}
}
},
"user.UserListResponse": {
"type": "object",
"properties": {
"limit": {
"type": "integer"
},
"offset": {
"type": "integer"
},
"total": {
"type": "integer"
},
"total_pages": {
"type": "integer"
},
"users": {
"type": "array",
"items": {
"$ref": "#/definitions/user.UserResponse"
}
}
}
},
"user.UserResponse": {
"type": "object",
"properties": {
"company_id": {
"type": "string"
},
"created_at": {
"type": "integer"
},
"created_by": {
"type": "string"
},
"department": {
"type": "string"
},
"email": {
"type": "string"
},
"full_name": {
"type": "string"
},
"id": {
"type": "string"
},
"is_verified": {
"type": "boolean"
},
"last_login_at": {
"type": "integer"
},
"phone": {
"type": "string"
},
"position": {
"type": "string"
},
"profile_image": {
"type": "string"
},
"role": {
"type": "string"
},
"status": {
"type": "string"
},
"updated_at": {
"type": "integer"
},
"updated_by": {
"type": "string"
},
"username": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"description": "Type \"Bearer\" followed by a space and JWT token.",
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
},
"tags": [
{
"description": "Customer management operations",
"name": "customers"
},
{
"description": "User management operations",
"name": "users"
},
{
"description": "Health check operations",
"name": "health"
},
{
"description": "Authentication operations",
"name": "auth"
}
]
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0.0",
Host: "localhost:8081",
BasePath: "/api/v1",
Schemes: []string{},
Title: "Tender Management API",
Description: "This is the API documentation for the Tender Management System.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}