Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
fix mongo.User.Remove
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Mar 31, 2022
1 parent 075061d commit e8d5611
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/infrastructure/mongo/auth_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (r *authRequestRepo) Save(ctx context.Context, request *auth.Request) error
}

func (r *authRequestRepo) Remove(ctx context.Context, requestID id.AuthRequestID) error {
return r.client.RemoveOne(ctx, requestID.String())
return r.client.RemoveOne(ctx, bson.M{"id": requestID.String()})
}

func (r *authRequestRepo) findOne(ctx context.Context, filter bson.D) (*auth.Request, error) {
Expand Down
5 changes: 2 additions & 3 deletions internal/infrastructure/mongo/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (r *userRepo) Save(ctx context.Context, user *user.User) error {
}

func (r *userRepo) Remove(ctx context.Context, user id.UserID) error {
return r.client.RemoveOne(ctx, user.String())
return r.client.RemoveOne(ctx, bson.M{"id": user.String()})
}

func (r *userRepo) find(ctx context.Context, dst []*user.User, filter bson.D) ([]*user.User, error) {
Expand All @@ -109,8 +109,7 @@ func (r *userRepo) find(ctx context.Context, dst []*user.User, filter bson.D) ([
return c.Rows, nil
}

func (r *userRepo) findOne(ctx context.Context, filter bson.D) (*user.User, error) {
dst := make([]*user.User, 0, 1)
func (r *userRepo) findOne(ctx context.Context, filter interface{}) (*user.User, error) {
c := mongodoc.UserConsumer{
Rows: dst,
}
Expand Down

0 comments on commit e8d5611

Please sign in to comment.