Add company management domain with CRUD operations and API enhancements
- Introduced a new company management domain, including entities, services, handlers, and forms for company operations. - Implemented CRUD functionality for companies, allowing for creation, retrieval, updating, and deletion of company records. - Enhanced API endpoints for company management, including search and filtering capabilities based on various criteria. - Integrated JWT-based user authorization for company management operations. - Updated Swagger documentation to include new company-related endpoints and detailed request/response structures. - Established MongoDB ORM integration for efficient data handling and repository management. - Added comprehensive validation rules for company forms to ensure data integrity and consistency. - Implemented logging for key operations within the company service and repository for better traceability.
This commit is contained in:
+2357
-100
File diff suppressed because it is too large
Load Diff
+2357
-100
File diff suppressed because it is too large
Load Diff
+1549
-107
File diff suppressed because it is too large
Load Diff
+11
-3
@@ -31,6 +31,9 @@ package main
|
||||
// @tag.name Customers-Authorization
|
||||
// @tag.description Customer authentication operations including login, logout, and token management
|
||||
|
||||
// @tag.name Companies-Admin
|
||||
// @tag.description Company management operations for web panel including CRUD, customer assignment, and tag management
|
||||
|
||||
// @tag.name Health
|
||||
// @tag.description Health check operations
|
||||
|
||||
@@ -39,6 +42,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
"tm/internal/company"
|
||||
"tm/internal/customer"
|
||||
"tm/internal/user"
|
||||
|
||||
@@ -80,9 +84,10 @@ func main() {
|
||||
// Initialize repositories with MongoDB connection manager
|
||||
userRepository := user.NewUserRepository(mongoManager, logger)
|
||||
customerRepository := customer.NewCustomerRepository(mongoManager, logger)
|
||||
companyRepository := company.NewCompanyRepository(mongoManager, logger)
|
||||
|
||||
logger.Info("Repositories initialized successfully", map[string]interface{}{
|
||||
"repositories": []string{"customer", "user"},
|
||||
"repositories": []string{"customer", "user", "company"},
|
||||
})
|
||||
|
||||
// Initialize validation service
|
||||
@@ -91,17 +96,19 @@ func main() {
|
||||
// Initialize services with repositories
|
||||
userService := user.NewUserService(userRepository, logger, userAuthService, userValidator)
|
||||
customerService := customer.NewCustomerService(customerRepository, logger, customerAuthService)
|
||||
companyService := company.NewCompanyService(companyRepository, logger)
|
||||
|
||||
logger.Info("Services initialized successfully", map[string]interface{}{
|
||||
"services": []string{"customer", "user"},
|
||||
"services": []string{"customer", "user", "company"},
|
||||
})
|
||||
|
||||
// Initialize handlers with services
|
||||
userHandler := user.NewUserHandler(userService, logger, userValidator, userAuthService)
|
||||
customerHandler := customer.NewHandler(customerService, userHandler, customerAuthService, logger)
|
||||
companyHandler := company.NewHandler(companyService, userHandler, logger)
|
||||
|
||||
logger.Info("Handlers initialized successfully", map[string]interface{}{
|
||||
"handlers": []string{"customer", "user"},
|
||||
"handlers": []string{"customer", "user", "company"},
|
||||
})
|
||||
|
||||
// Initialize HTTP server
|
||||
@@ -110,6 +117,7 @@ func main() {
|
||||
// Register routes
|
||||
userHandler.RegisterRoutes(e)
|
||||
customerHandler.RegisterRoutes(e)
|
||||
companyHandler.RegisterRoutes(e)
|
||||
|
||||
// Start server
|
||||
serverAddr := fmt.Sprintf("%s:%d", conf.Server.Host, conf.Server.Port)
|
||||
|
||||
Reference in New Issue
Block a user