diff --git a/internal/api/handler/list.go b/internal/api/handler/list.go index 3afd0c4..13f3445 100644 --- a/internal/api/handler/list.go +++ b/internal/api/handler/list.go @@ -54,7 +54,7 @@ func (h *ListHandler) CreateList(w http.ResponseWriter, r *http.Request) { return } - slog.InfoContext(ctx, "created list successfully", slog.Any("list_id", list.ID)) + slog.InfoContext(ctx, "created list successfully", slog.String("list_id", list.ID)) response.JSON(ctx, w, http.StatusCreated, list) } @@ -94,7 +94,7 @@ func (h *ListHandler) DeleteList(w http.ResponseWriter, r *http.Request) { return } - slog.InfoContext(ctx, "deleted list successfully", slog.Any("list_id", listID)) + slog.InfoContext(ctx, "deleted list successfully", slog.String("list_id", listID)) response.Status(w, http.StatusNoContent) } @@ -174,7 +174,10 @@ func (h *ListHandler) AddUserToList(w http.ResponseWriter, r *http.Request) { return } - slog.InfoContext(ctx, "added user to list successfully", slog.Any("list_id", payload.ListID), slog.Any("email", user.Email)) + slog.InfoContext(ctx, "added user to list successfully", + slog.String("list_id", payload.ListID), + slog.String("email", user.Email), + ) response.Status(w, http.StatusNoContent) } @@ -222,7 +225,10 @@ func (h *ListHandler) RemoveUserFromList(w http.ResponseWriter, r *http.Request) return } - slog.InfoContext(ctx, "removed user from list successfully", slog.Any("list_id", payload.ListID), slog.Any("email", user.Email)) + slog.InfoContext(ctx, "removed user from list successfully", + slog.String("list_id", payload.ListID), + slog.String("email", user.Email), + ) response.Status(w, http.StatusNoContent) } @@ -262,7 +268,7 @@ func (h *ListHandler) CreateListItem(w http.ResponseWriter, r *http.Request) { return } - slog.InfoContext(ctx, "created list item successfully", slog.Any("list_item_id", item.ID)) + slog.InfoContext(ctx, "created list item successfully", slog.String("list_item_id", item.ID)) response.JSON(ctx, w, http.StatusCreated, item) } @@ -302,7 +308,7 @@ func (h *ListHandler) DeleteListItem(w http.ResponseWriter, r *http.Request) { return } - slog.InfoContext(ctx, "deleted list item successfully", slog.Any("list_item_id", listItemID)) + slog.InfoContext(ctx, "deleted list item successfully", slog.String("list_item_id", listItemID)) response.Status(w, http.StatusNoContent) } @@ -343,7 +349,7 @@ func (h *ListHandler) UpdateListItem(w http.ResponseWriter, r *http.Request) { return } - slog.InfoContext(ctx, "updated list item successfully", slog.Any("list_item_id", payload.ListItemID)) + slog.InfoContext(ctx, "updated list item successfully", slog.String("list_item_id", payload.ListItemID)) response.Status(w, http.StatusNoContent) } @@ -393,7 +399,7 @@ func (h *ListHandler) SetListItemCompleted(w http.ResponseWriter, r *http.Reques return } - slog.InfoContext(ctx, "updated list item completed successful", slog.Any("list_item_id", listItemID)) + slog.InfoContext(ctx, "updated list item completed successful", slog.String("list_item_id", listItemID)) response.Status(w, http.StatusNoContent) } diff --git a/internal/domain/user.go b/internal/domain/user.go index d859dae..d61d871 100644 --- a/internal/domain/user.go +++ b/internal/domain/user.go @@ -9,7 +9,7 @@ import ( ) var ( - ErrUserIDMissing = errors.New("user id is missing") + ErrUserIDMissing = errors.New("user id is required") ErrEmailMissing = errors.New("email is required") ErrNameMissing = errors.New("name is required") ErrPasswordMissing = errors.New("password is required") diff --git a/internal/repository/list.go b/internal/repository/list.go index 1a0d470..d58d90a 100644 --- a/internal/repository/list.go +++ b/internal/repository/list.go @@ -93,7 +93,6 @@ func (r *ListRepo) GetLists(ctx context.Context, userID string) ([]domain.List, } return lists, nil - } func (r *ListRepo) AddUserToList(ctx context.Context, listID string, userID string) error {