Refactor Tender Management to Introduce Notice Entity and Repository
- Replaced the tender repository with a new notice repository, encapsulating notice-related data access methods. - Introduced the Notice entity to represent tender/contract notices, including relevant fields and methods for managing notice data. - Updated the TED scraper to utilize the new notice repository for creating and managing notices, enhancing the integration with the tender management system. - Implemented Ollama SDK initialization in the web bootstrap process, allowing for improved AI interactions. - Enhanced the tender service to include Ollama SDK for additional functionality, ensuring a more robust service layer.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package notice
|
||||
|
||||
import (
|
||||
"context"
|
||||
"tm/pkg/logger"
|
||||
)
|
||||
|
||||
// Service defines business logic for notice operations
|
||||
type Service interface {
|
||||
Import(ctx context.Context, form *Notice) error
|
||||
BulkImport(ctx context.Context, form []Notice) error
|
||||
}
|
||||
|
||||
// noticeService implements the Service interface
|
||||
type noticeService struct {
|
||||
repository Repository
|
||||
logger logger.Logger
|
||||
}
|
||||
|
||||
// NewService creates a new notice service
|
||||
func NewService(repository Repository, logger logger.Logger) Service {
|
||||
return ¬iceService{
|
||||
repository: repository,
|
||||
logger: logger,
|
||||
}
|
||||
}
|
||||
|
||||
// Import imports a new notice
|
||||
func (s *noticeService) Import(ctx context.Context, form *Notice) error {
|
||||
return s.repository.Import(ctx, form)
|
||||
}
|
||||
|
||||
// BulkImport imports a new notice
|
||||
func (s *noticeService) BulkImport(ctx context.Context, form []Notice) error {
|
||||
return s.repository.BulkImport(ctx, form)
|
||||
}
|
||||
Reference in New Issue
Block a user