This commit is contained in:
yash 2024-01-25 23:40:04 +03:00
parent bad50a81cc
commit d0b82dde31
2 changed files with 7 additions and 9 deletions

View File

@ -20,8 +20,6 @@ const (
//TODO
// cache
// app
// graceful sd
// tests
func main() {
@ -33,9 +31,9 @@ func main() {
log.Debug("debug messages are enabled")
log.Debug("Application config", slog.Any("config", fmt.Sprintf("%+v", *cfg)))
// init app (storage, cache, media storage)
// init app
application := app.New(log, cfg)
// start app
// start server
go application.HTTPSrv.MustRun()
// graceful shutdown

View File

@ -184,7 +184,7 @@ func (s *Storage) GetRecipe(ctx context.Context, r_id uint) (models.Recipe, erro
ctx,
"select title, description, image, cooking_time, servings, cal from recipe where id = $1",
r_id,
).Scan(&recipe)
).Scan(&recipe.Title, &recipe.Description, &recipe.Image, &recipe.CookingTime, &recipe.ServingsNum, &recipe.Calories)
if err != nil {
if errors.Is(err, pgx.ErrNoRows) {
@ -353,10 +353,10 @@ func (s *Storage) GetRecipesByCategory(ctx context.Context, offset, limit int, c
return nil, fmt.Errorf("%s: %w", op, err)
}
err = s.AddRecipeInformation(ctx, &r)
if err != nil {
return nil, fmt.Errorf("%s: %w", op, err)
}
// err = s.AddRecipeInformation(ctx, &r)
// if err != nil {
// return nil, fmt.Errorf("%s: %w", op, err)
// }
recipes = append(recipes, r)
}