added logout
This commit is contained in:
@@ -90,3 +90,11 @@ func (r *Repository) DeleteRefreshToken(ctx context.Context, id bson.ObjectID) e
|
||||
_, err := r.refreshTokensCollection.DeleteOne(ctx, bson.M{"_id": id})
|
||||
return err
|
||||
}
|
||||
|
||||
func (r *Repository) DeleteRefreshTokenByHash(ctx context.Context, hash string) (bool, error) {
|
||||
res, err := r.refreshTokensCollection.DeleteOne(ctx, bson.M{"token_hash": hash})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return res.DeletedCount > 0, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user