Documentation ¶
Overview ¶
Package model provides basic domain models.
Package model provides basic domain models.
Package model provides basic domain models.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
Category represents a menu section or dish category. Each category is associated with only one Restaurant.
type Characteristic ¶
type Characteristic struct { ID uint64 `db:"id"` Name string `db:"name"` Multiple bool `db:"multiple"` Variants []Variant `db:"variants"` }
Characteristic represents a property of a dish that can be configured individually by an user, for example `pizza size`. Each dish can have multiple characteristics, and each characteristic may be associated with multiple dishes (since `pizza size` will exist for both `Pizza Salami` and `Pizza Margherita`).
type Configuration ¶
type Configuration struct { ID uint64 `db:"id"` Characteristic Characteristic `db:"characteristic_id"` Variants []Variant `db:"variants"` }
Configuration represents the actual choice a user has made for a characteristic. If the user orders a pizza and chooses `pizza size: 30 cm`, the order position includes a Configuration saying that `pizza size` = `30 cm`. Therefore, it's simply a mapping of a dish's characteristic against one ore more concrete variants.
type Dish ¶
type Dish struct { ID uint64 `db:"id"` Name string `db:"name"` Description string `db:"description"` Price uint `db:"price"` IsUncertain bool `db:"is_uncertain"` IsHealthy bool `db:"is_healthy"` IsVegetarian bool `db:"is_vegetarian"` Characteristics []Characteristic `db:"characteristics"` }
Dish is a dish or meal offered by a restaurant. Each dish is associated with only one Category.
type Offer ¶
type Offer struct { ID uint64 `db:"id"` Owner User `db:"owner_user_id"` Restaurant Restaurant `db:"restaurant_id"` ValidFrom time.Time `db:"valid_from"` ValidTo time.Time `db:"valid_to"` Responsible User `db:"responsible_user_id"` IsPlaced bool `db:"is_placed"` IsCancelled bool `db:"is_cancelled"` ReadyAt time.Time `db:"ready_at"` PaypalEnabled bool `db:"paypal_enabled"` Orders []Order `db:"orders"` }
Offer represents an user's offer for ordering food for their team at a restaurant. If the food won't be delivered by the restaurant/delivery service, the owner of the offer is responsible for picking up the ordered food.
type Order ¶
type Order struct { ID uint64 `db:"id"` User User `db:"user_id"` Positions []Position `db:"positions"` IsPaid bool `db:"is_paid"` }
Order represents an user's order for a particular offer. In most cases, there will be multiple orders (i. e. multiple users ordering) at an offer.
type Position ¶
type Position struct { ID uint64 `db:"id"` Dish Dish `db:"dish_id"` Alternative Dish `db:"alternative_dish_id"` Note string `db:"note"` Configurations []Configuration `db:"configurations"` }
Position represents an order's position. It includes the actual dish ordered, next to an alternative dish if the actual dish isn't available for sure. A position also hold several configurations.
type Restaurant ¶
type Restaurant struct { ID uint64 `db:"id"` Name string `db:"name"` Street string `db:"street"` PostalCode string `db:"postal_code"` City string `db:"city"` Phone string `db:"phone"` OpenMon string `db:"open_mon"` OpenTue string `db:"open_tue"` OpenWed string `db:"open_wed"` OpenThu string `db:"open_thu"` OpenFri string `db:"open_fri"` OpenSat string `db:"open_sat"` OpenSun string `db:"open_sun"` Website string `db:"website"` IsActive bool `db:"is_active"` Menu []Category `db:"menu"` }
Restaurant represents a restaurant or delivery service. When a user creates an offer, the offer will be associated with exactly one Restaurant.
type User ¶
type User struct { ID uint64 `db:"id"` MailAddr string `db:"mail_addr"` Name string `db:"name"` IsAdmin bool `db:"is_admin"` PaypalMailAddr string `db:"paypal_mail_addr"` Score int `db:"score"` PasswordHash []byte `db:"password_hash"` Created time.Time `db:"created"` }
User represents an application user which will register and login in order to create an offer or order food at an existing offer.
type Variant ¶
type Variant struct { ID uint64 `db:"id"` Value string `db:"value"` IsDefault bool `db:"is_default"` Price uint `db:"price"` }
Variant represents a concrete value for a characteristic, for example `28 cm` for `pizza size`. It may be used for extra ingredients and therefore has a price.