-
This commit is contained in:
@ -144,8 +144,25 @@ func (s *tokenService) CreateStaticToken(ctx context.Context, req *domain.Create
|
||||
func (s *tokenService) ListByApp(ctx context.Context, appID string, limit, offset int) ([]*domain.StaticToken, error) {
|
||||
s.logger.Debug("Listing tokens for application", zap.String("app_id", appID))
|
||||
|
||||
// TODO: Implement actual token listing
|
||||
return []*domain.StaticToken{}, nil
|
||||
tokens, err := s.tokenRepo.GetByAppID(ctx, appID)
|
||||
if err != nil {
|
||||
s.logger.Error("Failed to list tokens from repository", zap.Error(err), zap.String("app_id", appID))
|
||||
return nil, fmt.Errorf("failed to list tokens: %w", err)
|
||||
}
|
||||
|
||||
// Apply pagination manually since GetByAppID doesn't support it
|
||||
start := offset
|
||||
end := offset + limit
|
||||
if start > len(tokens) {
|
||||
tokens = []*domain.StaticToken{}
|
||||
} else if end > len(tokens) {
|
||||
tokens = tokens[start:]
|
||||
} else {
|
||||
tokens = tokens[start:end]
|
||||
}
|
||||
|
||||
s.logger.Debug("Listed tokens successfully", zap.String("app_id", appID), zap.Int("count", len(tokens)))
|
||||
return tokens, nil
|
||||
}
|
||||
|
||||
// Delete deletes a token
|
||||
|
||||
Reference in New Issue
Block a user