place

package
v0.0.0-...-5789598 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var I18nMessages = messages{
	Failed:               "place_failed",
	InvalidUUID:          "place_invalid_uuid",
	NotFound:             "place_not_found",
	FeatureUUIDsNotFound: "place_feature_uuids_not_found",
}

Functions

This section is empty.

Types

type Entity

type Entity struct {
	UUID             string                   `json:"uuid"`
	FeatureUUIDs     []string                 `json:"featureUUIDs"`
	Images           []Image                  `json:"images"`
	Translations     map[Locale]*Translations `json:"translations"`
	AverageTimeSpent TimeSpent                `json:"averageTimeSpent"`
	Review           Review                   `json:"review"`
	Restorations     []Restoration            `json:"restorations"`
	Coordinates      []float64                `json:"coordinates"`
	IsActive         bool                     `json:"is_active"`
	IsDeleted        bool                     `json:"is_deleted"`
	IsPayed          bool                     `json:"is_payed"`
	Type             Type                     `json:"type"`
	UpdatedAt        time.Time                `json:"updated_at"`
	CreatedAt        time.Time                `json:"created_at"`
}

type EntityFilter

type EntityFilter struct {
	Locale           string
	Query            string
	Coordinates      []float64
	FeatureUUIDs     []string
	AverageTimeSpent *TimeSpent
	Distance         *float64
	IsPayed          *bool
	MinReview        *int16
	MaxReview        *int16
	Types            []Type
	MinAveragePoint  *float32
	MaxAveragePoint  *float32
	Sort             Sort
	Order            Order
}

func (*EntityFilter) GetPerfectDistance

func (e *EntityFilter) GetPerfectDistance() float64

func (*EntityFilter) IsZero

func (e *EntityFilter) IsZero() bool

type Errors

type Errors interface {
	Failed(string) *i18np.Error
	InvalidUUID() *i18np.Error
	NotFound() *i18np.Error
	FeatureUUIDsNotFound([]string) *i18np.Error
}

type EventConfig

type EventConfig struct {
	Topics    config.Topics
	Publisher events.Publisher
}

type Events

type Events interface{}

func NewEvents

func NewEvents(config EventConfig) Events

type Factory

type Factory struct {
	Errors Errors
}

func NewFactory

func NewFactory() Factory

func (Factory) IsZero

func (f Factory) IsZero() bool

func (Factory) New

func (f Factory) New(config NewConfig) *Entity

type I18nDetail

type I18nDetail struct {
	Locale string
	Slug   string
}

type Image

type Image struct {
	Url   string `json:"url"`
	Order int16  `json:"order"`
}

type Locale

type Locale string
const (
	LocaleEN Locale = "en"
	LocaleTR Locale = "tr"
)

func (Locale) String

func (l Locale) String() string

type NewConfig

type NewConfig struct {
	FeatureUUIDs     []string
	Images           []Image
	Translations     map[Locale]*Translations
	AverageTimeSpent TimeSpent
	Restorations     []Restoration
	Coordinates      []float64
	IsPayed          bool
	Type             Type
}

type Order

type Order string
const (
	OrderAsc  Order = "asc"
	OrderDesc Order = "desc"
)

func (Order) IsValid

func (o Order) IsValid() bool

type Repository

type Repository interface {
	Create(ctx context.Context, place *Entity) (string, *i18np.Error)
	Update(ctx context.Context, uuid string, place *Entity) *i18np.Error
	Disable(ctx context.Context, uuid string) *i18np.Error
	Delete(ctx context.Context, uuid string) *i18np.Error
	Enable(ctx context.Context, uuid string) *i18np.Error
	Filter(ctx context.Context, filter EntityFilter, listConfig list.Config) (*list.Result[*Entity], *i18np.Error)
	View(ctx context.Context, detail I18nDetail) (*Entity, *i18np.Error)
	AdminView(ctx context.Context, uuid string) (*Entity, *i18np.Error)
	List(ctx context.Context, filter EntityFilter, listConfig list.Config) (*list.Result[*Entity], *i18np.Error)
	AdminList(ctx context.Context, filter EntityFilter, listConfig list.Config) (*list.Result[*Entity], *i18np.Error)
}

type Restoration

type Restoration struct {
	StartDate *time.Time `json:"startDate"`
	EndDate   *time.Time `json:"endDate"`
}

type Review

type Review struct {
	Total        int16   `json:"total"`
	AveragePoint float32 `json:"averagePoint"`
}

type Seo

type Seo struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Keywords    string `json:"keywords"`
}

type Sort

type Sort string
const (
	SortByMostRecent Sort = "most_recent"
	SortByNearest    Sort = "nearest"
)

func (Sort) IsValid

func (s Sort) IsValid() bool

type TimeSpent

type TimeSpent struct {
	Min int16 `json:"min"`
	Max int16 `json:"max"`
}

type Translations

type Translations struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Slug        string `json:"slug"`
	MarkdownURL string `json:"markdownUrl"`
	Seo         Seo    `json:"seo"`
}

type Type

type Type string
const (
	TypeEating    Type = "eating"
	TypeCoffee    Type = "coffee"
	TypeBar       Type = "bar"
	TypeBeach     Type = "beach"
	TypeAmaze     Type = "amaze"
	TypeShopping  Type = "shopping"
	TypeTransport Type = "transport"
	TypeCulture   Type = "culture"
	TypeNature    Type = "nature"
	TypeHealth    Type = "health"
	TypeSport     Type = "sport"
	TypeNightlife Type = "nightlife"
	TypeGarden    Type = "garden"
	TypeTemple    Type = "temple"
	TypeMuseum    Type = "museum"
	TypeAntique   Type = "antique"
	TypePark      Type = "park"
	TypeThemePark Type = "themePark"
	TypeOther     Type = "other"
)

func (Type) IsType

func (t Type) IsType() bool

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL