mirror of
https://github.com/SamyRai/tercul-backend.git
synced 2025-12-27 05:11:34 +00:00
Merge pull request #11 from SamyRai/chore/update-tasks-md
Chore: Update TASKS.md
This commit is contained in:
commit
19ea277dae
18
TASKS.md
18
TASKS.md
@ -4,20 +4,6 @@ This document is the single source of truth for all outstanding development task
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Urgent: Build Failures
|
|
||||||
|
|
||||||
These issues are currently breaking the build and must be resolved before any other work can proceed. They are all related to the ongoing refactor, where repositories are being replaced by application services. The `r.App` object in the resolver does not have direct repository access anymore.
|
|
||||||
|
|
||||||
- [ ] **Fix Resolver Build Errors in `internal/adapters/graphql/schema.resolvers.go`:**
|
|
||||||
- [ ] `line 10`: Remove the unused "log" import.
|
|
||||||
- [ ] `lines 1071, 1073`: Replace `r.App.AuthorRepo` calls with the appropriate application service method (e.g., `r.App.Authors.FindByID`).
|
|
||||||
- [ ] `line 1089`: Correct the call to `r.App.Localization.GetAuthorBiography` as the method does not exist. The correct service and method must be identified.
|
|
||||||
- [ ] `lines 1141, 1143`: Replace `r.App.UserRepo` calls with the correct user application service method.
|
|
||||||
- [ ] `lines 1212, 1225`: Replace `r.App.TagRepo` calls with the correct tag application service method.
|
|
||||||
- [ ] `lines 1249, 1262`: Replace `r.App.CategoryRepo` calls with the correct category application service method.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## High Priority
|
## High Priority
|
||||||
|
|
||||||
### Architecture & Refactoring (see `refactor.md`)
|
### Architecture & Refactoring (see `refactor.md`)
|
||||||
@ -34,11 +20,11 @@ These issues are currently breaking the build and must be resolved before any ot
|
|||||||
### Features
|
### Features
|
||||||
- [ ] **Implement Analytics Features:**
|
- [ ] **Implement Analytics Features:**
|
||||||
- **Context:** This is required for user engagement insights. The following counts need to be implemented and stored, likely on the `Work` and `Translation` models.
|
- **Context:** This is required for user engagement insights. The following counts need to be implemented and stored, likely on the `Work` and `Translation` models.
|
||||||
- [ ] Implement view counting.
|
- [x] Implement view counting.
|
||||||
- [ ] Implement like counting.
|
- [ ] Implement like counting.
|
||||||
- [ ] Implement comment counting.
|
- [ ] Implement comment counting.
|
||||||
- [ ] Implement bookmark counting.
|
- [ ] Implement bookmark counting.
|
||||||
- [ ] Implement translation counting.
|
- [x] Implement translation counting.
|
||||||
- [ ] Implement a service to calculate popular translations based on the above metrics.
|
- [ ] Implement a service to calculate popular translations based on the above metrics.
|
||||||
- *Note: This is referenced in the old `TODO.md` and a TODO comment in `internal/jobs/linguistics/work_analysis_service.go`.*
|
- *Note: This is referenced in the old `TODO.md` and a TODO comment in `internal/jobs/linguistics/work_analysis_service.go`.*
|
||||||
|
|
||||||
|
|||||||
@ -227,6 +227,9 @@ func (r *mutationResolver) CreateTranslation(ctx context.Context, input model.Tr
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Increment translation count for the work
|
||||||
|
go r.App.Analytics.IncrementWorkTranslationCount(context.Background(), uint(workID))
|
||||||
|
|
||||||
// Convert to GraphQL model
|
// Convert to GraphQL model
|
||||||
return &model.Translation{
|
return &model.Translation{
|
||||||
ID: fmt.Sprintf("%d", createdTranslation.ID),
|
ID: fmt.Sprintf("%d", createdTranslation.ID),
|
||||||
@ -1095,6 +1098,9 @@ func (r *queryResolver) Work(ctx context.Context, id string) (*model.Work, error
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Increment view count in the background
|
||||||
|
go r.App.Analytics.IncrementWorkViews(context.Background(), uint(workID))
|
||||||
|
|
||||||
content := r.resolveWorkContent(ctx, workRecord.ID, workRecord.Language)
|
content := r.resolveWorkContent(ctx, workRecord.ID, workRecord.Language)
|
||||||
|
|
||||||
return &model.Work{
|
return &model.Work{
|
||||||
@ -1140,7 +1146,30 @@ func (r *queryResolver) Works(ctx context.Context, limit *int32, offset *int32,
|
|||||||
|
|
||||||
// Translation is the resolver for the translation field.
|
// Translation is the resolver for the translation field.
|
||||||
func (r *queryResolver) Translation(ctx context.Context, id string) (*model.Translation, error) {
|
func (r *queryResolver) Translation(ctx context.Context, id string) (*model.Translation, error) {
|
||||||
panic(fmt.Errorf("not implemented: Translation - translation"))
|
translationID, err := strconv.ParseUint(id, 10, 32)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("invalid translation ID: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
translationRecord, err := r.App.Translation.Queries.Translation(ctx, uint(translationID))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if translationRecord == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increment view count in the background
|
||||||
|
go r.App.Analytics.IncrementTranslationViews(context.Background(), uint(translationID))
|
||||||
|
|
||||||
|
// Convert to GraphQL model
|
||||||
|
return &model.Translation{
|
||||||
|
ID: id,
|
||||||
|
Name: translationRecord.Title,
|
||||||
|
Language: translationRecord.Language,
|
||||||
|
Content: &translationRecord.Content,
|
||||||
|
WorkID: fmt.Sprintf("%d", translationRecord.TranslatableID),
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Translations is the resolver for the translations field.
|
// Translations is the resolver for the translations field.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user