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