entity

package
v0.0.0-...-7a013b9 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionOrder    = "order"
	CollectionCafe     = "cafe"
	CollectionRoute    = "route"
	CollectionCity     = "city"
	CollectionCoupon   = "coupon"
	CollectionPayment  = "payment"
	CollectionSender   = "sender"
	CollectionReporter = "reporter"
)
View Source
const (
	OrderStatusNew      = "new"
	OrderStatusPaid     = "paid"
	OrderStatusDelivery = "delivery"
	OrderStatusDone     = "done"
	OrderStatusCanceled = "canceled"
)
View Source
const (
	PaymentStatusNew      = "new"
	PaymentStatusPaid     = "paid"
	PaymentStatusCanceled = "canceled"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cafe

type Cafe struct {
	ID           bson.ObjectId  `bson:"_id,omitempty"`
	Name         string         `bson:"name"`
	Rating       float32        `bson:"rating"`
	Cuisine      string         `bson:"cuisine"`
	MinimumPrice int64          `bson:"minimum_price"`
	CityID       bson.ObjectId  `bson:"city_id"`
	Positions    []CafePosition `bson:"positions"`
}

type CafePosition

type CafePosition struct {
	ID          string `bson:"id"`
	Name        string `bson:"name"`
	Description string `bson:"description"`
	Price       int64  `bson:"price"`
	ImageURL    string `bson:"image_url"`
}

type City

type City struct {
	CityID bson.ObjectId `bson:"_id,omitempty"`
	Name   string        `bson:"name"`
}

type Coupon

type Coupon struct {
	Code       string              `bson:"code"`
	Discount   float32             `bson:"discount"`
	ValidUntil bson.MongoTimestamp `bson:"valid_until"`
	Remaining  *int64              `bson:"remaining,omitempty"`
}

func (Coupon) IsValid

func (c Coupon) IsValid(t time.Time) bool

type Order

type Order struct {
	ID     bson.ObjectId `bson:"_id,omitempty"`
	UserID string        `bson:"user_id"`
	CafeID bson.ObjectId `bson:"cafe_id"`
	Status string        `bson:"status"`
	Coupon string        `bson:"coupon,omitempty"`
	Items  []OrderItem   `bson:"items"`
}

type OrderItem

type OrderItem struct {
	PositionID string `bson:"position_id"`
	Amount     int64  `bson:"amount"`
	Total      int64  `bson:"total_price"`
}

type Payment

type Payment struct {
	ID      bson.ObjectId `bson:"_id,omitempty"`
	OrderID bson.ObjectId `bson:"order_id"`
	UserID  string        `bson:"user_id"`
	Status  string        `bson:"status"`
}

type Reporter

type Reporter struct {
	ID        bson.ObjectId `bson:"_id,omitempty"`
	EventType string        `bson:"event_type"`
	Email     string        `bson:"email"`
}

type Route

type Route struct {
	ID          bson.ObjectId `bson:"_id,omitempty"`
	TrainNumber string        `bson:"train_number"`
	Stops       []RouteStop   `bson:"stops"`
	Tickets     []string      `bson:"tickets"`
}

type RouteStop

type RouteStop struct {
	CityID   bson.ObjectId       `bson:"city_id"`
	DateTime bson.MongoTimestamp `bson:"date_time"`
	Duration int64               `bson:"duration"`
}

type SenderAccount

type SenderAccount struct {
	ID         bson.ObjectId `bson:"_id,omitempty"`
	Active     bool          `bson:"active"`
	ServerHost string        `bson:"server_host"`
	ServerPort string        `bson:"server_port"`
	Email      string        `bson:"email"`
	Password   string        `bson:"password"`
}

Jump to

Keyboard shortcuts

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