| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- // Package models
- package models
- import "time"
- type Place struct {
- ID string `json:"id"`
- Type string `json:"type"`
- OwnerID string `json:"owner_id"`
- Title string `json:"title"`
- Description *string `json:"description"`
- Address *string `json:"address"`
- Lat float64 `json:"lat"`
- Lng float64 `json:"lng"`
- CoverImage *string `json:"cover_image"`
- AccessInfo *string `json:"access_info"`
- Status string `json:"status"`
- ModerationComment *string `json:"moderation_comment,omitempty"`
- Rating float64 `json:"rating"`
- ReviewsCount int `json:"reviews_count"`
- HourlyRate *int `json:"hourly_rate,omitempty"`
- Currency string `json:"currency"`
- MinHours int `json:"min_hours"`
- BookingURL *string `json:"booking_url,omitempty"`
- Tags []Tag `json:"tags"`
- Features []Feature `json:"features"`
- Images []PlaceImage `json:"images,omitempty"`
- Owner *User `json:"owner,omitempty"`
- CreatedAt time.Time `json:"created_at"`
- UpdatedAt time.Time `json:"updated_at"`
- PublishedAt *time.Time `json:"published_at,omitempty"`
- DeletedAt *time.Time `json:"-"`
- }
- type PlaceImage struct {
- ID string `json:"id"`
- PlaceID string `json:"place_id"`
- URL string `json:"url"`
- Alt string `json:"alt"`
- SortOrder int `json:"sort_order"`
- IsCover bool `json:"is_cover"`
- }
- type PlaceFilter struct {
- Type string
- OwnerID string
- TagIDs []string
- FeatureIDs []string
- MinRating float64
- PriceMin *int
- PriceMax *int
- Bounds *Bounds
- Limit_ int
- Sort string
- UserLat *float64
- UserLng *float64
- Status string
- IncludeTagsFeatures bool
- Cursor string
- CursorCreatedAt *time.Time
- CursorRating *float64
- }
- type PaginatedPlaces struct {
- Data []*Place `json:"data"`
- NextCursor string `json:"next_cursor"`
- HasMore bool `json:"has_more"`
- }
- type Bounds struct {
- SWLat float64
- SWLng float64
- NELat float64
- NELng float64
- }
- func (f PlaceFilter) Limit() int {
- if f.Limit_ <= 0 || f.Limit_ > 100 {
- return 20
- }
- return f.Limit_
- }
|