mirror of
https://github.com/SamyRai/tercul-backend.git
synced 2025-12-27 04:01:34 +00:00
Some checks failed
- Updated database models and repositories to replace uint IDs with UUIDs. - Modified test fixtures to generate and use UUIDs for authors, translations, users, and works. - Adjusted mock implementations to align with the new UUID structure. - Ensured all relevant functions and methods are updated to handle UUIDs correctly. - Added necessary imports for UUID handling in various files.
39 lines
1.4 KiB
Go
39 lines
1.4 KiB
Go
package localization
|
|
|
|
import (
|
|
"context"
|
|
"tercul/internal/domain"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// LocalizationQueries contains the query handlers for the localization aggregate.
|
|
type LocalizationQueries struct {
|
|
repo domain.LocalizationRepository
|
|
}
|
|
|
|
// NewLocalizationQueries creates a new LocalizationQueries handler.
|
|
func NewLocalizationQueries(repo domain.LocalizationRepository) *LocalizationQueries {
|
|
return &LocalizationQueries{repo: repo}
|
|
}
|
|
|
|
// GetTranslation returns a translation for a given key and language.
|
|
func (q *LocalizationQueries) GetTranslation(ctx context.Context, key string, language string) (string, error) {
|
|
return q.repo.GetTranslation(ctx, key, language)
|
|
}
|
|
|
|
// GetTranslations returns a map of translations for a given set of keys and language.
|
|
func (q *LocalizationQueries) GetTranslations(ctx context.Context, keys []string, language string) (map[string]string, error) {
|
|
return q.repo.GetTranslations(ctx, keys, language)
|
|
}
|
|
|
|
// GetAuthorBiography returns the biography of an author in a specific language.
|
|
func (q *LocalizationQueries) GetAuthorBiography(ctx context.Context, authorID uuid.UUID, language string) (string, error) {
|
|
return q.repo.GetAuthorBiography(ctx, authorID, language)
|
|
}
|
|
|
|
// GetWorkContent returns the content of a work in a specific language.
|
|
func (q *LocalizationQueries) GetWorkContent(ctx context.Context, workID uuid.UUID, language string) (string, error) {
|
|
return q.repo.GetWorkContent(ctx, workID, language)
|
|
}
|