Ejemplo n.º 1
0
func (serv ServiceImpl) MyOrders(date string, email string) (orders []*api.Order, err error) {
	u := model.User{Email: email}

	d, err := StringToTime(date)
	orders, err = u.OrdersForApi(d)
	return
}
Ejemplo n.º 2
0
func (serv ServiceImpl) MyAvaliableProducts(date string, email string) (products []*api.Product, err error) {
	u := model.User{Email: email}
	var prods []model.Product
	d, err := StringToTime(date)
	prods, err = u.AvaliableProducts(d)
	for _, p := range prods {
		products = append(products, p.ToApi())
	}
	return
}
Ejemplo n.º 3
0
func (serv ServiceImpl) PutUser(email string, input api.UserInput) (user *api.User, err error) {
	userModel := model.User{}
	modelUserInput := model.UserInput{
		Name:       input.Name,
		Email:      input.Email,
		AvatarLink: input.AvatarLink,
	}
	fmt.Printf("%s\n", modelUserInput)
	err = userModel.Put(email, modelUserInput)
	if err != nil {
		return
	}

	user = userModel.ToApi()
	return
}