mirror of
https://github.com/SamyRai/tercul-backend.git
synced 2025-12-27 05:11:34 +00:00
This commit isolates the `Work` aggregate into its own package at `internal/domain/work`, following the first step of the refactoring plan in `refactor.md`. - The `Work` struct, related types, and the `WorkRepository` interface have been moved to the new package. - A circular dependency between `domain` and `work` was resolved by moving the `AnalyticsRepository` to the `app` layer. - All references to the moved types have been updated across the entire codebase to fix compilation errors. - Test files, including mocks and integration tests, have been updated to reflect the new structure.
57 lines
1.8 KiB
Go
57 lines
1.8 KiB
Go
package sql
|
|
|
|
import (
|
|
"tercul/internal/app/analytics"
|
|
"tercul/internal/domain"
|
|
"tercul/internal/domain/auth"
|
|
"tercul/internal/domain/localization"
|
|
"tercul/internal/domain/work"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Repositories struct {
|
|
Work work.WorkRepository
|
|
User domain.UserRepository
|
|
Author domain.AuthorRepository
|
|
Translation domain.TranslationRepository
|
|
Comment domain.CommentRepository
|
|
Like domain.LikeRepository
|
|
Bookmark domain.BookmarkRepository
|
|
Collection domain.CollectionRepository
|
|
Tag domain.TagRepository
|
|
Category domain.CategoryRepository
|
|
Book domain.BookRepository
|
|
Publisher domain.PublisherRepository
|
|
Source domain.SourceRepository
|
|
Copyright domain.CopyrightRepository
|
|
Monetization domain.MonetizationRepository
|
|
Analytics analytics.Repository
|
|
Auth auth.AuthRepository
|
|
Localization localization.LocalizationRepository
|
|
}
|
|
|
|
// NewRepositories creates a new Repositories container
|
|
func NewRepositories(db *gorm.DB) *Repositories {
|
|
return &Repositories{
|
|
Work: NewWorkRepository(db),
|
|
User: NewUserRepository(db),
|
|
Author: NewAuthorRepository(db),
|
|
Translation: NewTranslationRepository(db),
|
|
Comment: NewCommentRepository(db),
|
|
Like: NewLikeRepository(db),
|
|
Bookmark: NewBookmarkRepository(db),
|
|
Collection: NewCollectionRepository(db),
|
|
Tag: NewTagRepository(db),
|
|
Category: NewCategoryRepository(db),
|
|
Book: NewBookRepository(db),
|
|
Publisher: NewPublisherRepository(db),
|
|
Source: NewSourceRepository(db),
|
|
Copyright: NewCopyrightRepository(db),
|
|
Monetization: NewMonetizationRepository(db),
|
|
Analytics: NewAnalyticsRepository(db),
|
|
Auth: NewAuthRepository(db),
|
|
Localization: NewLocalizationRepository(db),
|
|
}
|
|
}
|