package feedback import ( "time" ) // ListFeedbackForm represents the form for listing feedback type ListFeedbackForm struct { Feedbacks []FeedbackResponse `json:"feedbacks"` DateFrom *int64 `json:"date_from,omitempty" validate:"omitempty,min=0"` DateTo *int64 `json:"date_to,omitempty" validate:"omitempty,min=0"` Limit int `json:"limit" validate:"required,min=1,max=100"` Offset int `json:"offset" validate:"required,min=0"` } // ToggleFeedbackForm represents the form for toggling feedback (like/dislike) type ToggleFeedbackForm struct { TenderID string `json:"tender_id" validate:"required"` FeedbackType FeedbackType `json:"feedback_type" validate:"required,oneof=like dislike"` } // FeedbackResponse represents the response for feedback operations type FeedbackResponse struct { ID string `json:"id"` FeedbackType FeedbackType `json:"feedback_type"` UpdatedAt int64 `json:"updated_at"` CreatedAt int64 `json:"created_at"` TenderID string `json:"tender"` CustomerID *string `json:"customer_id"` CompanyId *string `json:"company_id"` } // GetDateFromTime returns the date_from as time.Time func (f *ListFeedbackForm) GetDateFromTime() *time.Time { if f.DateFrom == nil { return nil } t := time.Unix(*f.DateFrom, 0) return &t } // GetDateToTime returns the date_to as time.Time func (f *ListFeedbackForm) GetDateToTime() *time.Time { if f.DateTo == nil { return nil } t := time.Unix(*f.DateTo, 0) return &t } func (f *Feedback) ToResponse() *FeedbackResponse { return &FeedbackResponse{ ID: f.ID.Hex(), FeedbackType: f.FeedbackType, TenderID: f.TenderID, CustomerID: f.CustomerID, CompanyId: f.CompanyID, UpdatedAt: f.UpdatedAt, CreatedAt: f.CreatedAt, } }