Remove deprecated /api/v1/profile/with-companies endpoint and update related documentation

- Deleted the `/api/v1/profile/with-companies` endpoint from the API documentation, Swagger files, and router to streamline the API structure.
- Updated the `GetProfile` handler to utilize the `GetProfileWithCompanies` service method for improved data retrieval.
- Enhanced overall API documentation consistency by removing obsolete references and ensuring accurate representation of the current API structure.
This commit is contained in:
n.nakhostin
2025-08-12 10:02:47 +03:30
parent e3ee3d64ce
commit 047850cca3
5 changed files with 2 additions and 184 deletions
+2 -32
View File
@@ -777,7 +777,7 @@ func (h *Handler) GetProfile(c echo.Context) error {
return response.Unauthorized(c, "Customer not authenticated")
}
customer, err := h.service.GetProfile(c.Request().Context(), customerID)
resp, err := h.service.GetProfileWithCompanies(c.Request().Context(), customerID)
if err != nil {
if err.Error() == "customer not found" {
return response.NotFound(c, "Customer not found")
@@ -785,37 +785,7 @@ func (h *Handler) GetProfile(c echo.Context) error {
return response.InternalServerError(c, "Failed to get customer profile")
}
return response.Success(c, customer.ToResponse(), "Profile retrieved successfully")
}
// GetProfileWithCompanies retrieves customer profile with companies (Mobile)
// @Summary Get customer profile with companies
// @Description Retrieve current customer profile information along with their assigned companies.
// @Tags Authorization
// @Accept json
// @Produce json
// @Security BearerAuth
// @Success 200 {object} response.APIResponse{data=CustomerResponse} "Profile retrieved successfully"
// @Failure 401 {object} response.APIResponse "Unauthorized - Invalid or missing token"
// @Failure 404 {object} response.APIResponse "Not found - Customer not found"
// @Failure 500 {object} response.APIResponse "Internal server error"
// @Router /api/v1/profile/with-companies [get]
func (h *Handler) GetProfileWithCompanies(c echo.Context) error {
// Extract customer ID from JWT token context
customerID, err := GetCustomerIDFromContext(c)
if err != nil {
return response.Unauthorized(c, "Customer not authenticated")
}
customer, err := h.service.GetProfileWithCompanies(c.Request().Context(), customerID)
if err != nil {
if err.Error() == "customer not found" {
return response.NotFound(c, "Customer not found")
}
return response.InternalServerError(c, "Failed to get customer profile with companies")
}
return response.Success(c, customer, "Profile retrieved successfully")
return response.Success(c, resp, "Profile retrieved successfully")
}
// Logout handles customer logout (Mobile)