mirror of
https://github.com/SamyRai/tercul-backend.git
synced 2025-12-27 02:51:34 +00:00
- Fixes a potential panic in the background job queue by changing `log.Fatalf` to `log.Printf`, allowing for more graceful error handling.
- Implements all `panic("not implemented")` methods in the mock repositories for `Like`, `Work`, and `User`, enabling more robust testing.
- Consolidates duplicated `WorkAnalytics` and `TranslationAnalytics` structs into a central `internal/domain/analytics` package to reduce code duplication and improve maintainability.
- Corrects build errors that arose during testing, including an unused import and an incorrect struct field name in a mock repository.
23 lines
581 B
Go
23 lines
581 B
Go
package analytics
|
|
|
|
// WorkAnalytics contains analytics data for a work
|
|
type WorkAnalytics struct {
|
|
WorkID uint
|
|
ViewCount int64
|
|
LikeCount int64
|
|
CommentCount int64
|
|
BookmarkCount int64
|
|
TranslationCount int64
|
|
ReadabilityScore float64
|
|
SentimentScore float64
|
|
TopKeywords []string
|
|
PopularTranslations []TranslationAnalytics
|
|
}
|
|
|
|
// TranslationAnalytics contains analytics data for a translation
|
|
type TranslationAnalytics struct {
|
|
TranslationID uint
|
|
Language string
|
|
ViewCount int64
|
|
LikeCount int64
|
|
} |