meeting

package
v0.0.0-...-0ba6107 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2017 License: MIT Imports: 6 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMeetingNotFound if a meeting is not found in a store.
	ErrMeetingNotFound = wwm.Error{Code: http.StatusNotFound, Message: "The meeting does not exist"}
	// ErrNotAllowed if a user is not allowed to do something on a meeting.
	ErrNotAllowed = wwm.Error{Code: http.StatusUnauthorized, Message: "Not allowed on this meeting"}
)

Functions

This section is empty.

Types

type CustomerMail

type CustomerMail string

CustomerMail for representing the customer by mail.

type DetailedMeeting

type DetailedMeeting struct {
	ID         MeetingID       `json:"id"`
	Place      string          `json:"place"`
	Creator    string          `json:"creator"`
	Buyer      string          `json:"buyer"`
	Date       time.Time       `json:"date"`
	CloseDate  time.Time       `json:"closeDate"`
	Closed     bool            `json:"closed"`
	Orders     []DetailedOrder `json:"orders"`
	Offer      Offer           `json:"offer"`
	TotalPrice float64         `json:"totalPrice"`
	TotalItems []OrderItem     `json:"totalItems"`
}

DetailedMeeting has extended information of a meeting. For example the calculated price.

type DetailedOrder

type DetailedOrder struct {
	Customer   CustomerMail `json:"customer"`
	Payed      bool         `json:"payed"`
	Items      []OrderItem  `json:"items"`
	TotalPrice float64      `json:"totalPrice"`
	PayLink    string       `json:"payLink"`
}

DetailedOrder has extended information for an order.

func ToDetailedOrders

func ToDetailedOrders(orders []Order, products []Product, payPalLink string) []DetailedOrder

ToDetailedOrders of a list of products with a paypal link.

type Meeting

type Meeting struct {
	ID        MeetingID `json:"id"`
	Place     string    `json:"place"`
	Creator   string    `json:"creator"`
	Buyer     string    `json:"buyer"`
	Date      time.Time `json:"date"`
	CloseDate time.Time `json:"closeDate"`
	Closed    bool      `json:"closed"`
	Orders    []Order   `json:"orders"`
	Offer     Offer     `json:"offer"`
}

Meeting describes a planned meeting for multiple persons.

func (Meeting) Detailed

func (m Meeting) Detailed(paypalLink string) DetailedMeeting

Detailed version of a meeting.

func (Meeting) Reduced

func (m Meeting) Reduced() ReducedMeeting

Reduced version of the meeting.

type MeetingID

type MeetingID string

MeetingID uniquely identifies a meeting.

type Offer

type Offer []Product

Offer is a list of products that can be bought.

func (Offer) Put

func (o Offer) Put(p Product) Offer

Put the product into the offer, if it does not already exist.

func (Offer) Remove

func (o Offer) Remove(name ProductName) Offer

Remove a Product by name from an offer.

type Order

type Order struct {
	Customer CustomerMail `json:"customer"`
	Payed    bool         `json:"payed"`
	Items    []OrderItem  `json:"items"`
}

Order contains the order of a single customer.

func (Order) Detailed

func (order Order) Detailed(products []Product, paypalLink string) DetailedOrder

Detailed version of an order.

type OrderItem

type OrderItem struct {
	ItemName ProductName `json:"itemName"`
	Amount   int         `json:"amount"`
}

OrderItem is a single item of a order.

type Product

type Product struct {
	Name  ProductName `json:"name"`
	Price float64     `json:"price"`
}

Product that has a price.

type ProductName

type ProductName string

ProductName identifies a product by its name.

type ReadStore

type ReadStore interface {
	FindAll() ([]Meeting, error)
	FindAllReduced() ([]ReducedMeeting, error)
	FindOne(id MeetingID) (Meeting, error)
}

ReadStore can query meetings.

type ReducedMeeting

type ReducedMeeting struct {
	ID        MeetingID `json:"id"`
	Place     string    `json:"place"`
	Date      time.Time `json:"date"`
	CloseDate time.Time `json:"closeDate"`
	Closed    bool      `json:"closed"`
}

ReducedMeeting contains only limited (most important) data of a meeting.

func AllReduced

func AllReduced(meetings []Meeting) []ReducedMeeting

AllReduced of a meeting list.

type Store

type Store interface {
	ReadStore
	WriteStore
}

Store can read and write meetings.

type WriteStore

type WriteStore interface {
	Save(meeting Meeting) error
}

WriteStore can save (or change) a meeting.

Jump to

Keyboard shortcuts

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