Refactor API documentation and update endpoint tags for clarity
- Updated README.md to reflect changes in endpoint categories, renaming "Customers-Admin" to "Admin-Customers" and "Companies-Admin" to "Admin-Companies" for consistency. - Modified health check endpoint tags from "Health" to "Admin-Health" to align with the new naming convention. - Adjusted Swagger documentation to replace outdated tags and ensure accurate representation of the API structure. - Enhanced user and customer handler documentation to reflect the new "Admin-Authorization" and "Admin-Users" tags, improving clarity in the API documentation.
This commit is contained in:
+18
-18
@@ -28,7 +28,7 @@ func NewHandler(service Service, userHandler *user.Handler, logger logger.Logger
|
||||
// CreateCompany creates a new company (Web Panel)
|
||||
// @Summary Create a new company
|
||||
// @Description Create a new company with comprehensive information including business details, address, tags, and customer assignment. This endpoint is used by the web panel for full company registration.
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param company body CreateCompanyForm true "Company information including type, business details, address, tags, and optional customer assignment"
|
||||
@@ -67,7 +67,7 @@ func (h *Handler) CreateCompany(c echo.Context) error {
|
||||
// GetCompany retrieves a company by ID (Web Panel)
|
||||
// @Summary Get company by ID
|
||||
// @Description Retrieve detailed company information by company ID
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Company ID"
|
||||
@@ -94,7 +94,7 @@ func (h *Handler) GetCompany(c echo.Context) error {
|
||||
// UpdateCompany updates a company (Web Panel)
|
||||
// @Summary Update company information
|
||||
// @Description Update company information including business details, address, tags, and customer assignment
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Company ID"
|
||||
@@ -139,7 +139,7 @@ func (h *Handler) UpdateCompany(c echo.Context) error {
|
||||
// DeleteCompany deletes a company (Web Panel)
|
||||
// @Summary Delete company
|
||||
// @Description Soft delete a company by setting status to inactive
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Company ID"
|
||||
@@ -174,7 +174,7 @@ func (h *Handler) DeleteCompany(c echo.Context) error {
|
||||
// ListCompanies lists companies with filters and pagination (Web Panel)
|
||||
// @Summary List companies with filters and pagination
|
||||
// @Description Retrieve a paginated list of companies with advanced filtering options including search, type, status, industry, verification status, tags, and business criteria. Supports sorting and pagination.
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param search query string false "Search term to filter companies by name, description, or industry"
|
||||
@@ -220,7 +220,7 @@ func (h *Handler) ListCompanies(c echo.Context) error {
|
||||
// SearchCompanies searches companies with advanced filters (Web Panel)
|
||||
// @Summary Advanced search for companies
|
||||
// @Description Search companies with advanced filtering capabilities including tags, business criteria, and location
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param q query string false "Search query"
|
||||
@@ -261,7 +261,7 @@ func (h *Handler) SearchCompanies(c echo.Context) error {
|
||||
// UpdateCompanyStatus updates company status (Web Panel)
|
||||
// @Summary Update company status
|
||||
// @Description Update company account status (active, inactive, suspended, pending)
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Company ID"
|
||||
@@ -302,7 +302,7 @@ func (h *Handler) UpdateCompanyStatus(c echo.Context) error {
|
||||
// UpdateCompanyVerification updates company verification status (Web Panel)
|
||||
// @Summary Update company verification status
|
||||
// @Description Update company verification and compliance status
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Company ID"
|
||||
@@ -343,7 +343,7 @@ func (h *Handler) UpdateCompanyVerification(c echo.Context) error {
|
||||
// UpdateCompanyTags updates company tags (Web Panel)
|
||||
// @Summary Update company tags
|
||||
// @Description Update company tags (CPV, categories, keywords, specializations, certifications)
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Company ID"
|
||||
@@ -384,7 +384,7 @@ func (h *Handler) UpdateCompanyTags(c echo.Context) error {
|
||||
// AddTags adds tags to a company (Web Panel)
|
||||
// @Summary Add tags to company
|
||||
// @Description Add specific tags to a company
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Company ID"
|
||||
@@ -425,7 +425,7 @@ func (h *Handler) AddTags(c echo.Context) error {
|
||||
// RemoveTags removes tags from a company (Web Panel)
|
||||
// @Summary Remove tags from company
|
||||
// @Description Remove specific tags from a company
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Company ID"
|
||||
@@ -466,7 +466,7 @@ func (h *Handler) RemoveTags(c echo.Context) error {
|
||||
// VerifyCompany verifies a company (Web Panel)
|
||||
// @Summary Verify company
|
||||
// @Description Mark a company as verified
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Company ID"
|
||||
@@ -501,7 +501,7 @@ func (h *Handler) VerifyCompany(c echo.Context) error {
|
||||
// SuspendCompany suspends a company (Web Panel)
|
||||
// @Summary Suspend company
|
||||
// @Description Suspend a company account with reason
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Company ID"
|
||||
@@ -542,7 +542,7 @@ func (h *Handler) SuspendCompany(c echo.Context) error {
|
||||
// ActivateCompany activates a company (Web Panel)
|
||||
// @Summary Activate company
|
||||
// @Description Activate a suspended company account
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Company ID"
|
||||
@@ -577,7 +577,7 @@ func (h *Handler) ActivateCompany(c echo.Context) error {
|
||||
// GetCompanyStats returns company statistics (Web Panel)
|
||||
// @Summary Get company statistics
|
||||
// @Description Get comprehensive company statistics for dashboard
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} response.APIResponse{data=CompanyStatsResponse} "Company statistics retrieved successfully"
|
||||
@@ -596,7 +596,7 @@ func (h *Handler) GetCompanyStats(c echo.Context) error {
|
||||
// GetCompaniesByType retrieves companies by type (Web Panel)
|
||||
// @Summary Get companies by type
|
||||
// @Description Retrieve companies filtered by their type (private, public, government, ngo, startup)
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param type path string true "Company type" Enums(private, public, government, ngo, startup)
|
||||
@@ -654,7 +654,7 @@ func (h *Handler) GetCompaniesByType(c echo.Context) error {
|
||||
// GetCompaniesByStatus retrieves companies by status (Web Panel)
|
||||
// @Summary Get companies by status
|
||||
// @Description Retrieve companies filtered by their status (active, inactive, suspended, pending)
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param status path string true "Company status" Enums(active, inactive, suspended, pending)
|
||||
@@ -711,7 +711,7 @@ func (h *Handler) GetCompaniesByStatus(c echo.Context) error {
|
||||
// GetCompaniesByIndustry retrieves companies by industry (Web Panel)
|
||||
// @Summary Get companies by industry
|
||||
// @Description Retrieve companies filtered by their industry
|
||||
// @Tags Companies-Admin
|
||||
// @Tags Admin-Companies
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param industry path string true "Industry"
|
||||
|
||||
@@ -18,7 +18,6 @@ type CreateCustomerForm struct {
|
||||
Mobile *string `json:"mobile,omitempty" valid:"optional,length(10|20)"`
|
||||
|
||||
// Company customer fields
|
||||
CompanyName *string `json:"company_name,omitempty" valid:"optional,length(2|200)"`
|
||||
RegistrationNumber *string `json:"registration_number,omitempty" valid:"optional,length(5|50)"`
|
||||
TaxID *string `json:"tax_id,omitempty" valid:"optional,length(5|50)"`
|
||||
Industry *string `json:"industry,omitempty" valid:"optional,length(2|100)"`
|
||||
|
||||
@@ -31,7 +31,7 @@ func NewHandler(service Service, userHandler *user.Handler, authService authoriz
|
||||
// CreateCustomer creates a new customer (Web Panel)
|
||||
// @Summary Create a new customer
|
||||
// @Description Create a new customer with comprehensive information including personal details, company information, address, and business details. This endpoint is used by the web panel for full customer registration.
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param customer body CreateCustomerForm true "Customer information including type (individual|company|government), personal details, company info, address, and business details"
|
||||
@@ -71,7 +71,7 @@ func (h *Handler) CreateCustomer(c echo.Context) error {
|
||||
// GetCustomerByID retrieves a customer by ID (Web Panel)
|
||||
// @Summary Get customer by ID
|
||||
// @Description Retrieve detailed customer information by customer ID
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Customer ID"
|
||||
@@ -98,7 +98,7 @@ func (h *Handler) GetCustomerByID(c echo.Context) error {
|
||||
// GetCustomerByIDWithCompanies retrieves a customer by ID with companies (Web Panel)
|
||||
// @Summary Get customer by ID with companies
|
||||
// @Description Retrieve detailed customer information by customer ID including assigned companies
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Customer ID"
|
||||
@@ -125,7 +125,7 @@ func (h *Handler) GetCustomerByIDWithCompanies(c echo.Context) error {
|
||||
// UpdateCustomer updates a customer (Web Panel)
|
||||
// @Summary Update customer information
|
||||
// @Description Update customer information including personal details, company information, address, and business details
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Customer ID"
|
||||
@@ -171,7 +171,7 @@ func (h *Handler) UpdateCustomer(c echo.Context) error {
|
||||
// DeleteCustomer deletes a customer (Web Panel)
|
||||
// @Summary Delete customer
|
||||
// @Description Soft delete a customer by setting status to inactive
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Customer ID"
|
||||
@@ -206,7 +206,7 @@ func (h *Handler) DeleteCustomer(c echo.Context) error {
|
||||
// ListCustomers lists customers with filters and pagination
|
||||
// @Summary List customers with filters and pagination
|
||||
// @Description Retrieve a paginated list of customers with advanced filtering options including search, type, status, company, industry, verification status, and compliance status. Supports sorting and pagination.
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param search query string false "Search term to filter customers by name, email, or company name"
|
||||
@@ -245,7 +245,7 @@ func (h *Handler) ListCustomers(c echo.Context) error {
|
||||
// ListCustomersWithCompanies lists customers with companies and filters
|
||||
// @Summary List customers with companies and filters
|
||||
// @Description Retrieve a paginated list of customers with their assigned companies and advanced filtering options including search, type, status, company, industry, verification status, and compliance status. Supports sorting and pagination.
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param search query string false "Search term to filter customers by name, email, or company name"
|
||||
@@ -284,7 +284,7 @@ func (h *Handler) ListCustomersWithCompanies(c echo.Context) error {
|
||||
// UpdateCustomerStatus updates customer status (Web Panel)
|
||||
// @Summary Update customer status
|
||||
// @Description Update customer account status (active, inactive, suspended, pending)
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Customer ID"
|
||||
@@ -325,7 +325,7 @@ func (h *Handler) UpdateCustomerStatus(c echo.Context) error {
|
||||
// UpdateCustomerVerification updates customer verification status (Web Panel)
|
||||
// @Summary Update customer verification status
|
||||
// @Description Update customer verification and compliance status
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Customer ID"
|
||||
@@ -366,7 +366,7 @@ func (h *Handler) UpdateCustomerVerification(c echo.Context) error {
|
||||
// VerifyCustomer verifies a customer (Web Panel)
|
||||
// @Summary Verify customer
|
||||
// @Description Mark a customer as verified
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Customer ID"
|
||||
@@ -401,7 +401,7 @@ func (h *Handler) VerifyCustomer(c echo.Context) error {
|
||||
// SuspendCustomer suspends a customer (Web Panel)
|
||||
// @Summary Suspend customer
|
||||
// @Description Suspend a customer account with optional reason
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Customer ID"
|
||||
@@ -442,7 +442,7 @@ func (h *Handler) SuspendCustomer(c echo.Context) error {
|
||||
// ActivateCustomer activates a customer (Web Panel)
|
||||
// @Summary Activate customer
|
||||
// @Description Activate a suspended customer account
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Customer ID"
|
||||
@@ -477,7 +477,7 @@ func (h *Handler) ActivateCustomer(c echo.Context) error {
|
||||
// GetCustomersByCompanyID retrieves customers by company ID (Web Panel)
|
||||
// @Summary Get customers by company ID
|
||||
// @Description Retrieve all customers associated with a specific company
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param companyId path string true "Company ID"
|
||||
@@ -529,7 +529,7 @@ func (h *Handler) GetCustomersByCompanyID(c echo.Context) error {
|
||||
// GetCustomersByType retrieves customers by type
|
||||
// @Summary Get customers by type
|
||||
// @Description Retrieve customers filtered by their type (individual, company, or government). Useful for administrative reporting and management.
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param type path string true "Customer type" Enums(individual, company, government)
|
||||
@@ -585,7 +585,7 @@ func (h *Handler) GetCustomersByType(c echo.Context) error {
|
||||
// GetCustomersByStatus retrieves customers by status
|
||||
// @Summary Get customers by status
|
||||
// @Description Retrieve customers filtered by their account status (active, inactive, suspended, or pending). Useful for administrative monitoring and management.
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param status path string true "Customer status" Enums(active, inactive, suspended, pending)
|
||||
@@ -641,7 +641,7 @@ func (h *Handler) GetCustomersByStatus(c echo.Context) error {
|
||||
// AssignCompaniesToCustomer assigns companies to a customer (Web Panel)
|
||||
// @Summary Assign companies to a customer
|
||||
// @Description Assign one or more companies to a specific customer.
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Customer ID"
|
||||
@@ -682,7 +682,7 @@ func (h *Handler) AssignCompaniesToCustomer(c echo.Context) error {
|
||||
// RemoveCompaniesFromCustomer removes companies from a customer (Web Panel)
|
||||
// @Summary Remove companies from a customer
|
||||
// @Description Remove one or more companies from a specific customer.
|
||||
// @Tags Customers-Admin
|
||||
// @Tags Admin-Customers
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path string true "Customer ID"
|
||||
@@ -723,7 +723,7 @@ func (h *Handler) RemoveCompaniesFromCustomer(c echo.Context) error {
|
||||
// Login handles customer authentication
|
||||
// @Summary Customer login
|
||||
// @Description Authenticate customer with username (email) and password. Returns access token, refresh token, and customer information upon successful authentication.
|
||||
// @Tags Customers-Authorization
|
||||
// @Tags Authorization
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param login body LoginForm true "Login credentials (username/email and password)"
|
||||
@@ -757,7 +757,7 @@ func (h *Handler) Login(c echo.Context) error {
|
||||
// RefreshToken handles customer token refresh
|
||||
// @Summary Refresh customer access token
|
||||
// @Description Refresh access token using a valid refresh token. This allows customers to maintain their session without re-authentication.
|
||||
// @Tags Customers-Authorization
|
||||
// @Tags Authorization
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param refresh body RefreshTokenForm true "Refresh token for generating new access token"
|
||||
@@ -788,7 +788,7 @@ func (h *Handler) RefreshToken(c echo.Context) error {
|
||||
// GetProfile retrieves customer profile information (Mobile)
|
||||
// @Summary Get customer profile
|
||||
// @Description Retrieve current customer profile information
|
||||
// @Tags Customers-Authorization
|
||||
// @Tags Authorization
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -796,7 +796,7 @@ func (h *Handler) RefreshToken(c echo.Context) error {
|
||||
// @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/ [get]
|
||||
// @Router /api/v1/profile [get]
|
||||
func (h *Handler) GetProfile(c echo.Context) error {
|
||||
// Extract customer ID from JWT token context
|
||||
customerID, err := GetCustomerIDFromContext(c)
|
||||
@@ -818,7 +818,7 @@ func (h *Handler) GetProfile(c echo.Context) error {
|
||||
// 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 Customers-Authorization
|
||||
// @Tags Authorization
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -826,7 +826,7 @@ func (h *Handler) GetProfile(c echo.Context) error {
|
||||
// @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/with-companies [get]
|
||||
// @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)
|
||||
@@ -848,14 +848,14 @@ func (h *Handler) GetProfileWithCompanies(c echo.Context) error {
|
||||
// Logout handles customer logout (Mobile)
|
||||
// @Summary Customer logout
|
||||
// @Description Logout customer and invalidate access token
|
||||
// @Tags Customers-Authorization
|
||||
// @Tags Authorization
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
// @Success 200 {object} response.APIResponse "Logout successful"
|
||||
// @Failure 401 {object} response.APIResponse "Unauthorized - Invalid or missing token"
|
||||
// @Failure 500 {object} response.APIResponse "Internal server error"
|
||||
// @Router /api/v1/logout [delete]
|
||||
// @Router /api/v1/profile/logout [delete]
|
||||
func (h *Handler) Logout(c echo.Context) error {
|
||||
// Extract customer ID from JWT token context
|
||||
customerID, err := GetCustomerIDFromContext(c)
|
||||
|
||||
@@ -81,14 +81,6 @@ func (s *customerService) CreateCustomer(ctx context.Context, form *CreateCustom
|
||||
return nil, errors.New("customer with this email already exists")
|
||||
}
|
||||
|
||||
// Check if company name already exists (for company customers)
|
||||
if form.Type == string(CustomerTypeCompany) && form.CompanyName != nil {
|
||||
existingCustomer, _ = s.repository.GetByCompanyName(ctx, *form.CompanyName)
|
||||
if existingCustomer != nil {
|
||||
return nil, errors.New("company with this name already exists")
|
||||
}
|
||||
}
|
||||
|
||||
// Check if registration number already exists (for company customers)
|
||||
if form.Type == string(CustomerTypeCompany) && form.RegistrationNumber != nil {
|
||||
existingCustomer, _ = s.repository.GetByRegistrationNumber(ctx, *form.RegistrationNumber)
|
||||
|
||||
+16
-16
@@ -31,7 +31,7 @@ func NewUserHandler(service Service, logger logger.Logger, validator ValidationS
|
||||
// Login handles user login
|
||||
// @Summary Authenticate user login
|
||||
// @Description Authenticate user with username/email and password to obtain access and refresh tokens for web panel administration. This endpoint validates credentials and returns JWT tokens for subsequent API calls.
|
||||
// @Tags Authorization
|
||||
// @Tags Admin-Authorization
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param login body LoginForm true "User login credentials including username/email and password"
|
||||
@@ -60,7 +60,7 @@ func (h *Handler) Login(c echo.Context) error {
|
||||
// RefreshToken handles token refresh
|
||||
// @Summary Refresh access token
|
||||
// @Description Generate a new access token using a valid refresh token. This endpoint allows clients to obtain fresh access tokens without re-authentication, maintaining session continuity.
|
||||
// @Tags Authorization
|
||||
// @Tags Admin-Authorization
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param refresh body RefreshTokenForm true "Refresh token for generating new access token"
|
||||
@@ -87,7 +87,7 @@ func (h *Handler) RefreshToken(c echo.Context) error {
|
||||
// ResetPassword handles password reset request
|
||||
// @Summary Initiate password reset process
|
||||
// @Description Send password reset email to user with reset token. This endpoint validates the email address and sends a secure reset link to the user's registered email address.
|
||||
// @Tags Authorization
|
||||
// @Tags Admin-Authorization
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param reset body ResetPasswordForm true "Email address for password reset request"
|
||||
@@ -117,7 +117,7 @@ func (h *Handler) ResetPassword(c echo.Context) error {
|
||||
// GetProfile gets current user profile
|
||||
// @Summary Get authenticated user profile
|
||||
// @Description Retrieve complete profile information for the currently authenticated user including personal details, role information, permissions, and account status. This endpoint requires valid authentication token.
|
||||
// @Tags Users
|
||||
// @Tags Admin-Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -144,7 +144,7 @@ func (h *Handler) GetProfile(c echo.Context) error {
|
||||
// UpdateProfile updates current user profile
|
||||
// @Summary Update authenticated user profile
|
||||
// @Description Update profile information for the currently authenticated user including personal details, contact information, and preferences. Only the authenticated user can update their own profile.
|
||||
// @Tags Users
|
||||
// @Tags Admin-Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -179,7 +179,7 @@ func (h *Handler) UpdateProfile(c echo.Context) error {
|
||||
// ChangePassword changes current user password
|
||||
// @Summary Change user password
|
||||
// @Description Change password for the currently authenticated user. Requires current password verification and enforces password policy. This operation invalidates all existing sessions and requires re-authentication.
|
||||
// @Tags Users
|
||||
// @Tags Admin-Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -214,7 +214,7 @@ func (h *Handler) ChangePassword(c echo.Context) error {
|
||||
// Logout handles user logout
|
||||
// @Summary Logout authenticated user
|
||||
// @Description Logout the currently authenticated user by invalidating their access and refresh tokens. This endpoint ensures secure session termination and prevents further use of the user's tokens.
|
||||
// @Tags Authorization
|
||||
// @Tags Admin-Authorization
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -247,7 +247,7 @@ func (h *Handler) Logout(c echo.Context) error {
|
||||
// CreateUser creates a new user (admin only)
|
||||
// @Summary Create new user account
|
||||
// @Description Create a new user account with specified role and permissions. This endpoint is restricted to administrators only and allows creation of various user types including admins, managers, and operators with appropriate access levels.
|
||||
// @Tags Users
|
||||
// @Tags Admin-Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -289,7 +289,7 @@ func (h *Handler) CreateUser(c echo.Context) error {
|
||||
// ListUsers lists users with search and filters (admin only)
|
||||
// @Summary List users
|
||||
// @Description List users with search and filters (admin only)
|
||||
// @Tags Users
|
||||
// @Tags Admin-Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -330,7 +330,7 @@ func (h *Handler) ListUsers(c echo.Context) error {
|
||||
// GetUserByID gets a user by ID (admin only)
|
||||
// @Summary Get user by ID
|
||||
// @Description Get user details by ID (admin only)
|
||||
// @Tags Users
|
||||
// @Tags Admin-Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -356,7 +356,7 @@ func (h *Handler) GetUserByID(c echo.Context) error {
|
||||
// UpdateUser updates a user (admin only)
|
||||
// @Summary Update user
|
||||
// @Description Update user information (admin only)
|
||||
// @Tags Users
|
||||
// @Tags Admin-Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -400,7 +400,7 @@ func (h *Handler) UpdateUser(c echo.Context) error {
|
||||
// DeleteUser deletes a user (admin only)
|
||||
// @Summary Delete user
|
||||
// @Description Delete a user (admin only)
|
||||
// @Tags Users
|
||||
// @Tags Admin-Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -434,7 +434,7 @@ func (h *Handler) DeleteUser(c echo.Context) error {
|
||||
// UpdateUserStatus updates user status (admin only)
|
||||
// @Summary Update user status
|
||||
// @Description Update user account status (admin only)
|
||||
// @Tags Users
|
||||
// @Tags Admin-Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -479,7 +479,7 @@ func (h *Handler) UpdateUserStatus(c echo.Context) error {
|
||||
// UpdateUserRole updates user role (admin only)
|
||||
// @Summary Update user role
|
||||
// @Description Update user role (admin only)
|
||||
// @Tags Users
|
||||
// @Tags Admin-Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -525,7 +525,7 @@ func (h *Handler) UpdateUserRole(c echo.Context) error {
|
||||
// GetUsersByCompanyID gets users by company ID (admin only)
|
||||
// @Summary Get users by company ID
|
||||
// @Description Get users belonging to a specific company (admin only)
|
||||
// @Tags Users
|
||||
// @Tags Admin-Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
@@ -585,7 +585,7 @@ func (h *Handler) GetUsersByCompanyID(c echo.Context) error {
|
||||
// GetUsersByRole gets users by role (admin only)
|
||||
// @Summary Get users by role
|
||||
// @Description Get users with a specific role (admin only)
|
||||
// @Tags Users
|
||||
// @Tags Admin-Users
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security BearerAuth
|
||||
|
||||
Reference in New Issue
Block a user