From d0b82dde31deb271ad81fe7eeac563c0e457ab2e Mon Sep 17 00:00:00 2001 From: yash Date: Thu, 25 Jan 2024 23:40:04 +0300 Subject: [PATCH] fixings --- cmd/recipes/main.go | 6 ++---- internal/storage/postgresql/postgresql.go | 10 +++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/cmd/recipes/main.go b/cmd/recipes/main.go index 25472a8..b726bc7 100644 --- a/cmd/recipes/main.go +++ b/cmd/recipes/main.go @@ -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 diff --git a/internal/storage/postgresql/postgresql.go b/internal/storage/postgresql/postgresql.go index a3e9567..034ca52 100644 --- a/internal/storage/postgresql/postgresql.go +++ b/internal/storage/postgresql/postgresql.go @@ -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) }