Esempio 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
}
Esempio 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
}
Esempio 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
}