Files
tm_back/cmd/web/docs/docs.go
T
n.nakhostin 9119e2383e Add configuration file and update server settings
- Introduced a new `config.yaml` file for managing server, database, cache, queue, AI, scraping, logging, and rate limiting configurations.
- Updated `docker-compose.yml` to reflect the new server port (8081) and adjusted health check endpoints accordingly.
- Modified `Dockerfile` to expose the new server port.
- Updated `README.md` to reflect changes in server configuration and added documentation for the new configuration structure.
- Added test scripts for server and Swagger documentation testing.
- Refactored customer domain structure to align with new configuration settings and improve maintainability.
2025-08-02 12:37:04 +03:30

1174 lines
40 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"
}
}
}
}
}
},
"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"
}
}
}
},
"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": "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)
}