fixings
This commit is contained in:
parent
bad50a81cc
commit
d0b82dde31
|
@ -20,8 +20,6 @@ const (
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
// cache
|
// cache
|
||||||
// app
|
|
||||||
// graceful sd
|
|
||||||
// tests
|
// tests
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -33,9 +31,9 @@ func main() {
|
||||||
log.Debug("debug messages are enabled")
|
log.Debug("debug messages are enabled")
|
||||||
log.Debug("Application config", slog.Any("config", fmt.Sprintf("%+v", *cfg)))
|
log.Debug("Application config", slog.Any("config", fmt.Sprintf("%+v", *cfg)))
|
||||||
|
|
||||||
// init app (storage, cache, media storage)
|
// init app
|
||||||
application := app.New(log, cfg)
|
application := app.New(log, cfg)
|
||||||
// start app
|
// start server
|
||||||
go application.HTTPSrv.MustRun()
|
go application.HTTPSrv.MustRun()
|
||||||
|
|
||||||
// graceful shutdown
|
// graceful shutdown
|
||||||
|
|
|
@ -184,7 +184,7 @@ func (s *Storage) GetRecipe(ctx context.Context, r_id uint) (models.Recipe, erro
|
||||||
ctx,
|
ctx,
|
||||||
"select title, description, image, cooking_time, servings, cal from recipe where id = $1",
|
"select title, description, image, cooking_time, servings, cal from recipe where id = $1",
|
||||||
r_id,
|
r_id,
|
||||||
).Scan(&recipe)
|
).Scan(&recipe.Title, &recipe.Description, &recipe.Image, &recipe.CookingTime, &recipe.ServingsNum, &recipe.Calories)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, pgx.ErrNoRows) {
|
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)
|
return nil, fmt.Errorf("%s: %w", op, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.AddRecipeInformation(ctx, &r)
|
// err = s.AddRecipeInformation(ctx, &r)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return nil, fmt.Errorf("%s: %w", op, err)
|
// return nil, fmt.Errorf("%s: %w", op, err)
|
||||||
}
|
// }
|
||||||
|
|
||||||
recipes = append(recipes, r)
|
recipes = append(recipes, r)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue