Remove obsolete customer endpoint and update related documentation

- Deleted the `/admin/v1/customers/{id}/with-companies` endpoint from the API documentation and Swagger files to streamline the API structure.
- Updated the router to remove the corresponding route registration for the deprecated endpoint.
- Enhanced the company repository and service to support batch retrieval of companies by IDs, improving efficiency in data handling.
- Adjusted customer service methods to utilize the new batch retrieval functionality for loading companies associated with customers.
- Improved logging practices to provide better traceability for company retrieval operations.
This commit is contained in:
n.nakhostin
2025-08-11 19:12:31 +03:30
parent a1db2a9790
commit e3ee3d64ce
8 changed files with 100 additions and 219 deletions
-67
View File
@@ -2840,73 +2840,6 @@ const docTemplate = `{
}
}
},
"/admin/v1/customers/{id}/with-companies": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Retrieve detailed customer information by customer ID including assigned companies",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Customers"
],
"summary": "Get customer by ID with companies",
"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 - Invalid customer ID",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"404": {
"description": "Not found - Customer not found",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/admin/v1/health": {
"get": {
"description": "Get comprehensive server health status including system information, dependencies status, and performance metrics. This endpoint is used for monitoring and load balancer health checks.",
-67
View File
@@ -2834,73 +2834,6 @@
}
}
},
"/admin/v1/customers/{id}/with-companies": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Retrieve detailed customer information by customer ID including assigned companies",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin-Customers"
],
"summary": "Get customer by ID with companies",
"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 - Invalid customer ID",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"404": {
"description": "Not found - Customer not found",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/response.APIResponse"
}
}
}
}
},
"/admin/v1/health": {
"get": {
"description": "Get comprehensive server health status including system information, dependencies status, and performance metrics. This endpoint is used for monitoring and load balancer health checks.",
-41
View File
@@ -2546,47 +2546,6 @@ paths:
summary: Verify customer
tags:
- Admin-Customers
/admin/v1/customers/{id}/with-companies:
get:
consumes:
- application/json
description: Retrieve detailed customer information by customer ID including
assigned companies
parameters:
- description: Customer ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Customer retrieved successfully
schema:
allOf:
- $ref: '#/definitions/response.APIResponse'
- properties:
data:
$ref: '#/definitions/customer.CustomerResponse'
type: object
"400":
description: Bad request - Invalid customer ID
schema:
$ref: '#/definitions/response.APIResponse'
"404":
description: Not found - Customer not found
schema:
$ref: '#/definitions/response.APIResponse'
"500":
description: Internal server error
schema:
$ref: '#/definitions/response.APIResponse'
security:
- BearerAuth: []
summary: Get customer by ID with companies
tags:
- Admin-Customers
/admin/v1/customers/company/{companyId}:
get:
consumes:
-2
View File
@@ -73,9 +73,7 @@ func RegisterAdminRoutes(e *echo.Echo, userHandler *user.Handler, companyHandler
customersGP.Use(userHandler.AuthMiddleware())
customersGP.POST("", customerHandler.CreateCustomer)
customersGP.GET("", customerHandler.ListCustomers)
customersGP.GET("/with-companies", customerHandler.ListCustomersWithCompanies)
customersGP.GET("/:id", customerHandler.GetCustomerByID)
customersGP.GET("/:id/with-companies", customerHandler.GetCustomerByIDWithCompanies)
customersGP.PUT("/:id", customerHandler.UpdateCustomer)
customersGP.DELETE("/:id", customerHandler.DeleteCustomer)
customersGP.PATCH("/:id/status", customerHandler.UpdateCustomerStatus)