Files
tm_back/README.md
T
n.nakhostin 6906577f6e Add Documentation for Contributors and Jira Task Creation
- Introduced a new CONTRIBUTORS.md file to outline the team structure and roles involved in the project, enhancing transparency and collaboration.
- Created a JIRA_TASK_RULES.md file detailing mandatory rules and standards for creating Jira tasks, ensuring consistency and clarity in task management.
- Included guidelines on task labels, sprint assignments, relationships, and structure to streamline the task creation process.
- Added critical reminders to emphasize the importance of proper task management practices within the team.
2025-09-17 10:31:38 +03:30

349 lines
11 KiB
Markdown

# Tender Management System
A comprehensive tender management backend system built with Go, following Clean Architecture principles with Domain-Driven Design (DDD) patterns.
## 👥 Team
Meet our development team and their roles in this project.
**[👥 View Team Members](./CONTRIBUTORS.md)** - Complete team structure and contact information
## 📚 Documentation
All documentation has been organized in the [`docs/`](./docs/) directory for better structure and maintainability.
### Quick Links
- **[📖 Main Documentation](./docs/README.md)** - Comprehensive project overview and guidelines
- **[🔧 Setup Guides](./docs/setup/)** - HTTP server and Swagger setup
- **[🚀 Implementation Details](./docs/implementation/)** - Architecture and implementation overview
- **[📡 API Examples](./docs/examples/)** - API usage examples and endpoints
## 🚀 Quick Start
1. **Setup Environment**
```bash
# Follow setup guides in docs/setup/
```
2. **Run the Application**
```bash
make run
```
3. **Access API Documentation**
- Swagger UI: `http://localhost:8081/swagger/index.html`
- API Base URL: `http://localhost:8081/api/v1`
## 🏗️ 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
## 🚧 Phase 1 Implementation Status
**Current Completion: 70-75%** - The foundation is excellent with TED integration, company management, and admin panel. Critical gaps exist in mobile app features and feedback system.
### ✅ **Completed Features (100%)**
#### 1. **TED Integration**
- ✅ TED XML Bulk Import with comprehensive parser
- ✅ XML Parser supporting all TED notice types
- ✅ Complete data storage with all required fields
- ✅ Unique tender ID generation system
- ✅ Submission deadline calculation (2 weeks before notice)
- ✅ Source tracking and metadata management
#### 2. **Company Profile Management**
- ✅ Username & password authentication system
- ✅ Complete tags system (CPV codes, categories, keywords)
- ✅ Company verification and compliance tracking
- ✅ Address and contact information management
#### 3. **Admin Panel (Web)**
- ✅ Complete company CRUD operations
- ✅ User management and authentication
- ✅ Tag assignment and management
- ✅ Tender management and search
- ✅ Scraping job control and monitoring
### 🔄 **Partially Implemented (60-80%)**
#### 4. **Tender Matching Logic**
- ✅ Basic CPV code matching algorithm
- ✅ Category tags structure
- ❌ Abstract text relevance analysis
- ✅ Basic match percentage calculation
#### 5. **Mobile App Backend**
- ✅ Authentication system (login/logout)
- ✅ Basic tender access endpoints
- ❌ Advanced filtering capabilities
- ❌ Comprehensive search functionality
- ❌ Like/Dislike feedback system
### ❌ **Missing Features (0%)**
#### 6. **Feedback System**
- ❌ Like/Dislike functionality
- ❌ Interest tracking and history
- ❌ Company-tender feedback relationships
#### 7. **Advanced Mobile Features**
- ❌ Comprehensive filtering (date, status, location)
- ❌ Advanced search (title, abstract, buyer)
- ❌ Detailed tender information endpoints
- ❌ Feedback and rating system
## 📋 **TODO List - Phase 1 Completion**
### 🔴 **High Priority - Critical Features**
#### 1. **Feedback System Implementation**
- [ ] Create new domain `internal/feedback/`
- [ ] Implement `TenderFeedback` entity
- [ ] Add repository for feedback storage
- [ ] Implement feedback management service
- [ ] Add API endpoints for like/dislike
- [ ] Implement authentication middleware for feedback
#### 2. **Enhanced Tender Matching Algorithm**
- [ ] Improve `CalculateMatchPercentage` function
- [ ] Add abstract text analysis for relevance scoring
- [ ] Implement matching based on keywords and specializations
- [ ] Add weighting system for different match criteria
- [ ] Optimize matching algorithm performance
#### 3. **Database Optimization**
- [ ] Create indexes for search fields in MongoDB
- [ ] Add compound indexes for complex queries
- [ ] Optimize queries for better performance
- [ ] Add text indexes for text search
### 🟡 **Medium Priority - Mobile Features**
#### 4. **Advanced Mobile APIs**
- [ ] Add endpoint for company-matched tenders
- [ ] Implement advanced filtering (date, status, location)
- [ ] Add search by title and abstract
- [ ] Implement pagination for long lists
- [ ] Add sorting by match percentage and date
#### 5. **Advanced Filtering System**
- [ ] Filter by deadline time range
- [ ] Filter by tender status
- [ ] Filter by country and region
- [ ] Filter by tender type
- [ ] Filter by estimated value
- [ ] Filter by CPV codes
#### 6. **Advanced Search System**
- [ ] Search in tender titles
- [ ] Search in abstract text
- [ ] Search in buyer organization names
- [ ] Combined search (title + text + location)
- [ ] Fuzzy search for better results
### 🟢 **Low Priority - Enhancements**
#### 7. **Recommendation System**
- [ ] Implement recommendation algorithm based on feedback history
- [ ] Add "similar tenders" based on CPV codes
- [ ] Implement "suggested tenders" for companies
- [ ] Add scoring system for prioritization
#### 8. **Analytics and Reporting**
- [ ] Add feedback statistics to admin panel
- [ ] Report companies with most feedback activity
- [ ] Statistics on popular and unpopular tenders
- [ ] Company matching effectiveness reports
#### 9. **Performance Optimization**
- [ ] Add caching for matching results
- [ ] Optimize queries using aggregation pipelines
- [ ] Implement background jobs for match calculations
- [ ] Add rate limiting for APIs
### 🔧 **Testing and Documentation**
#### 10. **Testing**
- [ ] Write unit tests for feedback system
- [ ] Integration tests for new APIs
- [ ] Performance tests for matching algorithm
- [ ] Load tests for mobile endpoints
#### 11. **Documentation**
- [ ] Update Swagger documentation
- [ ] API documentation for mobile
- [ ] Implementation guide for feedback system
- [ ] Matching algorithm documentation
### 📱 **Mobile-Specific Features**
#### 12. **Authentication and Security**
- [ ] Improve JWT token management
- [ ] Add refresh token rotation
- [ ] Implement rate limiting for login attempts
- [ ] Add device tracking
#### 13. **Push Notifications**
- [ ] Implement notification system for new tenders
- [ ] Notifications for high-match tenders
- [ ] Deadline approaching notifications
- [ ] Personalized notification settings
### 🗄️ **Data Management**
#### 14. **Data Migration**
- [ ] Migration scripts for new tables
- [ ] Update existing schemas
- [ ] Data cleanup and validation
- [ ] Backup and restore procedures
#### 15. **Monitoring and Logging**
- [ ] Add metrics for feedback system
- [ ] Logging for matching operations
- [ ] Alerting for critical errors
- [ ] Performance monitoring
## 📊 **Project Status Summary**
- **Completed**: 70-75%
- **In Progress**: 0%
- **Remaining**: 25-30%
## ⏱️ **Estimated Completion Time**
- **High Priority**: 2-3 weeks
- **Medium Priority**: 3-4 weeks
- **Low Priority**: 2-3 weeks
- **Total Estimated Time**: 7-10 weeks
## 🚀 **Next Steps**
To complete Phase 1, start with the **Feedback System** implementation because:
1. It's the foundation for other features
2. Has lower complexity
3. Directly impacts user experience
## 🔧 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 `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
#### 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"`
}
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](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
```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
- Redis (optional)
### 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
```
### 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
## 📝 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
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.