0a23ff985abb6862eb3966396bd05b603de82c23
- Updated the tender service to include company-based matching for tenders, allowing for more relevant results based on company CPV codes. - Modified the ListTenders endpoint to accept a company ID parameter for calculating match percentages and sorting tenders accordingly. - Refactored the tender response structure to include match percentage and days until deadline for better client-side handling. - Updated API documentation to reflect changes in the tender listing functionality and added new endpoints for public tender access. - Removed deprecated customer-related methods and streamlined customer listing functionality for improved clarity and performance.
Tender Management System
A comprehensive tender management backend system built with Go, following Clean Architecture principles with Domain-Driven Design (DDD) patterns.
📚 Documentation
All documentation has been organized in the docs/ directory for better structure and maintainability.
Quick Links
- 📖 Main Documentation - Comprehensive project overview and guidelines
- 🔧 Setup Guides - HTTP server and Swagger setup
- 🚀 Implementation Details - Architecture and implementation overview
- 📡 API Examples - API usage examples and endpoints
🚀 Quick Start
-
Setup Environment
# Follow setup guides in docs/setup/ -
Run the Application
make run -
Access API Documentation
- Swagger UI:
http://localhost:8081/swagger/index.html - API Base URL:
http://localhost:8081/api/v1
- Swagger UI:
🏗️ Architecture
This system implements Clean Architecture with:
- Domain Layer: Business entities and core rules
- Service Layer: Business logic and use cases
- Handler Layer: HTTP controllers and request handling
- Repository Layer: Data access implementations
- Infrastructure Layer: External dependencies
📋 Key Features
- Clean Architecture: DDD principles with clear separation of concerns
- MongoDB Integration: Robust data persistence with proper indexing
- Structured Logging: Comprehensive logging with context
- Input Validation: Govalidator integration for request validation
- Error Handling: Consistent error responses and logging
- Time Handling: Unix timestamps throughout the application
- Generic XML Parser: Parse any XML structure into Go structs using generics
🔧 New Features
Generic XML Parser
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.
Features
- Generic Support: Parse any XML structure that implements the
Parseableinterface - 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
Quick Example
// 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"`
}
func (c Contract) Validate() error { /* validation logic */ }
func (c Contract) GetID() string { return c.ID }
// Parse XML
parser := xmlparser.NewParser[Contract](nil)
contract, err := parser.ParseString(xmlData)
See pkg/xmlparser/README.md for complete documentation and examples.
📦 Package Structure
├── 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
# Run all tests
make test
# Test specific package
go test ./pkg/xmlparser/...
# Test with coverage
make test-coverage
🛠️ Development
Prerequisites
- Go 1.23+
- MongoDB
- Redis (optional)
Local Development
# Clone repository
git clone <repository-url>
cd tm_back
# Install dependencies
go mod tidy
# Run tests
make test
# Start development server
make dev
Adding New Features
- Follow Clean Architecture principles
- Implement proper logging in service layer
- Add comprehensive validation
- Write unit tests
- Update documentation
📝 Contributing
- Fork the repository
- Create a feature branch
- Follow coding standards
- Add tests for new features
- Update documentation
- Submit a pull request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Description
Languages
Go
99.2%
Shell
0.5%
Makefile
0.2%
Dockerfile
0.1%