service.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Package models
  2. package models
  3. import "time"
  4. type Service struct {
  5. ID string `json:"id"`
  6. ExecutorID string `json:"executor_id"`
  7. Title string `json:"title"`
  8. Description *string `json:"description"`
  9. Price int `json:"price"`
  10. Currency string `json:"currency"`
  11. DurationMinutes *int `json:"duration_minutes"`
  12. Status string `json:"status"`
  13. Rating float64 `json:"rating"`
  14. ReviewsCount int `json:"reviews_count"`
  15. Tags []Tag `json:"tags"`
  16. PortfolioImages []ServiceImage `json:"portfolio_images,omitempty"`
  17. CreatedAt time.Time `json:"created_at"`
  18. UpdatedAt time.Time `json:"updated_at"`
  19. DeletedAt *time.Time `json:"-"`
  20. }
  21. type ServiceImage struct {
  22. ID string `json:"id"`
  23. ServiceID string `json:"service_id"`
  24. URL string `json:"url"`
  25. Alt string `json:"alt"`
  26. SortOrder int `json:"sort_order"`
  27. }
  28. type ServiceFilter struct {
  29. Tags []string
  30. MinRating float64
  31. PriceMin *int
  32. PriceMax *int
  33. Status string
  34. Limit_ int
  35. }
  36. func (f ServiceFilter) Limit() int {
  37. if f.Limit_ <= 0 || f.Limit_ > 100 {
  38. return 20
  39. }
  40. return f.Limit_
  41. }