Remove github.com/google/uuid dependency and update module files

- Deleted the `github.com/google/uuid` dependency from `go.mod` to streamline the project and reduce unnecessary dependencies.
- Updated `go.sum` to reflect the removal of the UUID package.
- Enhanced the overall module management by ensuring only necessary dependencies are included.
This commit is contained in:
n.nakhostin
2025-08-12 12:15:14 +03:30
parent 2d32ae0b2b
commit 7dc695752b
9 changed files with 1208 additions and 86 deletions
+90 -83
View File
@@ -45,106 +45,113 @@ This system implements **Clean Architecture** with:
- **Input Validation**: Govalidator integration for request validation
- **Error Handling**: Consistent error responses and logging
- **Time Handling**: Unix timestamps throughout the application
- **API Documentation**: Auto-generated Swagger documentation
- **Generic XML Parser**: Parse any XML structure into Go structs using generics
## 📋 API Documentation
## 🔧 New Features
### Swagger/OpenAPI 3.0 Documentation
### Generic XML Parser
The Tender Management API features comprehensive, auto-generated Swagger documentation with:
A powerful, generic XML parser built with Go generics that can parse any XML structure into Go structs. Perfect for handling complex XML formats like TED (Tenders Electronic Daily) notices.
#### 🚀 **Version 2.0.0 Features**
- **Comprehensive API Coverage**: All endpoints documented with detailed descriptions, examples, and error responses
- **Interactive API Testing**: Built-in Swagger UI for testing endpoints directly from the documentation
- **Authentication Integration**: Bearer token authentication examples and testing capability
- **Request/Response Examples**: Real-world examples for all data structures and API calls
- **Error Documentation**: Detailed error codes, messages, and troubleshooting information
#### Features
- **Generic Support**: Parse any XML structure that implements the `Parseable` interface
- **Flexible Configuration**: Customizable parsing options for different use cases
- **Built-in Validation**: Automatic validation of parsed structures
- **Metadata Extraction**: Extract XML metadata and parsing information
- **TED XML Support**: Pre-built models for TED contract notices
- **Error Reporting**: Detailed error and warning reporting
#### 📊 **API Endpoints Categories**
- **Health**: System monitoring and health check endpoints
- **Authorization**: User authentication, token management, and session handling
- **Users**: Administrative user management with RBAC (Role-Based Access Control)
- **Admin-Customers**: Web panel customer management with advanced filtering
- **Customers-Authorization**: Mobile app customer authentication and profile access
- **Admin-Companies**: Comprehensive company management with search, filtering, and analytics
#### Quick Example
```go
// Define your XML structure
type Contract struct {
XMLName xml.Name `xml:"Contract"`
ID string `xml:"id,attr"`
Name string `xml:"name"`
Value string `xml:"value"`
}
#### 🔧 **Documentation Access**
- **Local Development**: `http://localhost:8081/swagger/`
- **Interactive Testing**: All endpoints can be tested directly from the Swagger UI
- **Authentication**: Use the "Authorize" button to set Bearer tokens for protected endpoints
- **Export Options**: JSON and YAML formats available for API specifications
func (c Contract) Validate() error { /* validation logic */ }
func (c Contract) GetID() string { return c.ID }
#### 📝 **Enhanced Features**
- **Detailed Descriptions**: Each endpoint includes comprehensive business logic explanations
- **Parameter Validation**: Complete validation rules and constraints for all input parameters
- **Response Examples**: Real-world response examples with proper HTTP status codes
- **Security Schemes**: JWT Bearer token authentication clearly documented
- **Error Handling**: Comprehensive error response documentation with troubleshooting guides
- **Filtering & Pagination**: Advanced query parameters for list endpoints with examples
- **Business Logic**: Context-aware descriptions explaining when and how to use each endpoint
#### 🏗️ **Technical Specifications**
- **OpenAPI/Swagger 2.0**: Industry-standard API documentation format
- **Auto-Generation**: Documentation automatically updated from code annotations
- **Type Safety**: Strong typing with Go struct validation and examples
- **Validation Rules**: Complete govalidator integration for request validation
- **Consistent Response Format**: Standardized API response structure with metadata
#### 💡 **Usage Examples**
```bash
# Access Swagger UI
curl http://localhost:8081/swagger/
# Download API specification
curl http://localhost:8081/swagger/doc.json
# Test authentication endpoint
curl -X POST "http://localhost:8081/admin/v1/login" \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "password"}'
// Parse XML
parser := xmlparser.NewParser[Contract](nil)
contract, err := parser.ParseString(xmlData)
```
#### 🔐 **Authentication Testing**
1. Navigate to Swagger UI at `/swagger/`
2. Click "Authorize" button
3. Enter: `Bearer <your_jwt_token>`
4. Test protected endpoints directly from the interface
See [pkg/xmlparser/README.md](pkg/xmlparser/README.md) for complete documentation and examples.
### API Design Principles
- **RESTful Design**: Consistent REST principles with proper HTTP methods and status codes
- **Clean Architecture**: Domain-driven design with clear separation of concerns
- **Validation**: Comprehensive input validation with meaningful error messages
- **Security**: JWT-based authentication with proper token management
- **Performance**: Optimized queries with pagination and filtering capabilities
- **Maintainability**: Auto-generated documentation stays in sync with code changes
## 📦 Package Structure
## 🔧 Development
```
├── cmd/ # Application entry points
├── internal/ # Private application code
│ ├── company/ # Company domain
│ ├── customer/ # Customer domain
│ └── user/ # User domain
├── pkg/ # Public packages
│ ├── authorization/ # Authorization utilities
│ ├── logger/ # Structured logging
│ ├── mongo/ # MongoDB utilities
│ ├── redis/ # Redis utilities
│ ├── response/ # HTTP response utilities
│ └── xmlparser/ # Generic XML parser
├── infra/ # Infrastructure configuration
└── docs/ # Documentation
```
## 🧪 Testing
```bash
# Run all tests
make test
# Test specific package
go test ./pkg/xmlparser/...
# Test with coverage
make test-coverage
```
## 🛠️ Development
### Prerequisites
- Go 1.23+
- MongoDB 4.4+
- Valid MongoDB connection
- MongoDB
- Redis (optional)
### Project Structure
```
tm_back/
├── cmd/web/ # Application entry point
├── internal/ # Private application code
│ ├── customer/ # Customer domain
│ └── ... # Other domains
├── pkg/ # Public packages
│ ├── logger/ # Logging utilities
│ ├── mongo/ # MongoDB utilities
│ └── response/ # API response utilities
├── docs/ # 📚 All documentation
└── config.yaml # Configuration file
### Local Development
```bash
# Clone repository
git clone <repository-url>
cd tm_back
# Install dependencies
go mod tidy
# Run tests
make test
# Start development server
make dev
```
## 📞 Support
### Adding New Features
1. Follow Clean Architecture principles
2. Implement proper logging in service layer
3. Add comprehensive validation
4. Write unit tests
5. Update documentation
For detailed documentation, guides, and examples, please visit the [`docs/`](./docs/) directory.
## 📝 Contributing
---
1. Fork the repository
2. Create a feature branch
3. Follow coding standards
4. Add tests for new features
5. Update documentation
6. Submit a pull request
**Version**: 1.0.0
**Last Updated**: $(date)
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.