tercul-backend/internal/app/translation/service.go
google-labs-jules[bot] f675c98e80 Fix: Correct authorization logic in integration tests
The integration tests for admin-only mutations were failing due to an authorization issue. The root cause was that the JWT token used in the tests did not reflect the user's admin role, which was being set directly in the database.

This commit fixes the issue by:
1.  Updating the `CreateAuthenticatedUser` test helper to generate a new JWT token after a user's role is changed. This ensures the token contains the correct, up-to-date role.
2.  Removing all uses of `auth.ContextWithAdminUser` from the integration tests, making the JWT token the single source of truth for authorization.

This change also removes unused imports and variables that were causing build failures after the refactoring. All integration tests now pass.
2025-10-04 23:48:44 +00:00

21 lines
495 B
Go

package translation
import (
"tercul/internal/app/authz"
"tercul/internal/domain"
)
// Service is the application service for the translation aggregate.
type Service struct {
Commands *TranslationCommands
Queries *TranslationQueries
}
// NewService creates a new translation Service.
func NewService(repo domain.TranslationRepository, authzSvc *authz.Service) *Service {
return &Service{
Commands: NewTranslationCommands(repo, authzSvc),
Queries: NewTranslationQueries(repo),
}
}