Compare commits
No commits in common. "2c925513d578eea2817b479ef6c25d24dc2415a1" and "0ba2f10b36c94f28ab70ef05672db42ad58c08ba" have entirely different histories.
2c925513d5
...
0ba2f10b36
@ -3,7 +3,6 @@ package repository
|
|||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -849,8 +848,7 @@ func (r *RecipeRepository) GetRecipeFavorite(recipe *domain.Recipe, userId int)
|
|||||||
|
|
||||||
// GetRecipeOfTheWeek searches for the most recent recipe of the week. If there is not a value,
|
// GetRecipeOfTheWeek searches for the most recent recipe of the week. If there is not a value,
|
||||||
// the recipe will be nil. This function simply collects the most recent entry in the recipeoftheweek
|
// the recipe will be nil. This function simply collects the most recent entry in the recipeoftheweek
|
||||||
// table and return it. If there is no entry, nil will be returned Any errors will be bubbled to
|
// table and return it. Any errors will be bubbled to the caller.
|
||||||
// the caller.
|
|
||||||
func (r *RecipeRepository) GetRecipeOfTheWeek(userId *int) (*domain.Recipe, error) {
|
func (r *RecipeRepository) GetRecipeOfTheWeek(userId *int) (*domain.Recipe, error) {
|
||||||
tx, err := r.db.Begin()
|
tx, err := r.db.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -886,9 +884,6 @@ func (r *RecipeRepository) GetRecipeOfTheWeek(userId *int) (*domain.Recipe, erro
|
|||||||
&recipe.Modified,
|
&recipe.Modified,
|
||||||
&recipe.Created,
|
&recipe.Created,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
if errors.Is(err, sql.ErrNoRows) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("Failed to location recipe in database: %s", err.Error())
|
return nil, fmt.Errorf("Failed to location recipe in database: %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user