diff --git a/internal/controller/user.go b/internal/controller/user.go index e75edb8..94c9176 100644 --- a/internal/controller/user.go +++ b/internal/controller/user.go @@ -17,7 +17,7 @@ func (c *Controller) GetAllUsers(w http.ResponseWriter, r *http.Request) { return } - response.Result(w, users) + response.OK(w, users) return } diff --git a/internal/database/bbolt/user.go b/internal/database/bbolt/user.go index 41f673d..77504f0 100644 --- a/internal/database/bbolt/user.go +++ b/internal/database/bbolt/user.go @@ -23,14 +23,16 @@ func (d *bboltDB) GetAllUsers() ([]*schema.User, error) { return fmt.Errorf("bson: failed to unmarshal %v", err) } - users.append(user) + users = append(users, user) + + return nil }); err != nil { return err } - return users, nil + return nil }); err != nil { - return users, err + return users, nil } return users, nil diff --git a/internal/database/mongodb/user.go b/internal/database/mongodb/user.go index 4527ade..277266d 100644 --- a/internal/database/mongodb/user.go +++ b/internal/database/mongodb/user.go @@ -11,7 +11,7 @@ import ( "go.mongodb.org/mongo-driver/bson" ) -func (d *mongoDB) GetUser() ([]*schema.User, error) { +func (d *mongoDB) GetAllUsers() ([]*schema.User, error) { var users []*schema.User return users, nil }