(ctx context.Context, token string)
| 46 | } |
| 47 | |
| 48 | func (s *TokenService) GetTokenByToken(ctx context.Context, token string) (*Token, error) { |
| 49 | var tokenObj Token |
| 50 | err := s.tokenCollection.FindOne(ctx, bson.M{"token": token}).Decode(&tokenObj) |
| 51 | if err != nil { |
| 52 | return nil, err |
| 53 | } |
| 54 | return &tokenObj, nil |
| 55 | } |
| 56 | |
| 57 | func (s *TokenService) UpdateToken(ctx context.Context, token *Token) (*Token, error) { |
| 58 | _, err := s.tokenCollection.UpdateOne(ctx, bson.M{"_id": token.ID}, bson.M{"$set": token}) |
no outgoing calls