Refactor Feedback Module for Consistency and Clarity
- Updated feedback repository and service methods to use a consistent naming convention, changing `NewTenderRepository` and similar methods to `NewRepository`. - Refactored feedback handler methods to improve clarity by renaming methods such as `ListFeedback` to `Search` and `GetFeedback` to `Get`. - Enhanced feedback response structures to include detailed company and tender information, improving the clarity of feedback data returned to API consumers. - Updated Swagger documentation to reflect changes in feedback response structures and endpoint paths, ensuring accurate representation of the API for consumers.
This commit is contained in:
@@ -29,7 +29,7 @@ type inquiryRepository struct {
|
||||
}
|
||||
|
||||
// NewInquiryRepository creates a new inquiry repository
|
||||
func NewInquiryRepository(mongoManager *orm.ConnectionManager, logger logger.Logger) Repository {
|
||||
func NewRepository(mongoManager *orm.ConnectionManager, logger logger.Logger) Repository {
|
||||
// Create indexes using the ORM's index management
|
||||
indexes := []orm.Index{
|
||||
*orm.CreateTextIndex("search_idx", "full_name", "company_name", "work_email"),
|
||||
@@ -72,10 +72,10 @@ func (r *inquiryRepository) Create(ctx context.Context, inquiry *Inquiry) error
|
||||
now := time.Now().Unix()
|
||||
inquiry.SetCreatedAt(now)
|
||||
inquiry.SetUpdatedAt(now)
|
||||
|
||||
|
||||
// Set initial status to pending
|
||||
inquiry.Status = StatusPending
|
||||
|
||||
|
||||
// Add initial status change to history
|
||||
inquiry.AddStatusChange(StatusPending, "Inquiry submitted", "system", "Initial inquiry submission")
|
||||
|
||||
@@ -140,10 +140,10 @@ func (r *inquiryRepository) UpdateStatus(ctx context.Context, id string, status,
|
||||
}
|
||||
|
||||
r.logger.Info("Inquiry status updated successfully", map[string]interface{}{
|
||||
"inquiry_id": id,
|
||||
"old_status": inquiry.StatusHistory[len(inquiry.StatusHistory)-2].Status, // Previous status
|
||||
"new_status": status,
|
||||
"changed_by": changedBy,
|
||||
"inquiry_id": id,
|
||||
"old_status": inquiry.StatusHistory[len(inquiry.StatusHistory)-2].Status, // Previous status
|
||||
"new_status": status,
|
||||
"changed_by": changedBy,
|
||||
})
|
||||
|
||||
return nil
|
||||
|
||||
@@ -25,8 +25,8 @@ type inquiryService struct {
|
||||
logger logger.Logger
|
||||
}
|
||||
|
||||
// NewInquiryService creates a new inquiry service
|
||||
func NewInquiryService(repository Repository, sdk notification.SDK, logger logger.Logger) Service {
|
||||
// NewService creates a new inquiry service
|
||||
func NewService(repository Repository, sdk notification.SDK, logger logger.Logger) Service {
|
||||
return &inquiryService{
|
||||
repository: repository,
|
||||
sdk: sdk,
|
||||
|
||||
Reference in New Issue
Block a user