mirror of
https://github.com/SamyRai/tercul-backend.git
synced 2025-12-27 02:51:34 +00:00
This commit includes a major refactoring of the GORM many-to-many relationships to use explicit join tables, improving stability and compatibility with GORM's features. It also implements a large number of previously unimplemented GraphQL mutations for core entities like Collections, Comments, Likes, and Bookmarks. Key changes: - Refactored polymorphic many-to-many relationships for Copyright and Monetization to use standard many-to-many with explicit join tables. - Implemented GraphQL mutations for Collection, Comment, Like, and Bookmark entities, including input validation and authorization checks. - Added comprehensive integration tests for all new features and refactored code. - Refactored the GraphQL integration test suite to be type-safe, using generics for response handling as requested. - Updated repository interfaces and implementations to support the new data model. - Updated the TODO.md file to reflect the completed work.
67 lines
3.7 KiB
Markdown
67 lines
3.7 KiB
Markdown
# TODO List for Tercul Go Application
|
|
|
|
---
|
|
|
|
## [ ] Performance Improvements
|
|
|
|
- [ ] Implement batching for Weaviate operations (Medium, 2d)
|
|
|
|
## [ ] Security Enhancements
|
|
|
|
- [x] Add comprehensive input validation for all GraphQL mutations (High, 2d) - *Partially complete. Core mutations are validated.*
|
|
|
|
## [ ] Code Quality & Architecture
|
|
|
|
- [ ] Expand Weaviate client to support all models (Medium, 2d)
|
|
- [ ] Add code documentation and API docs (Medium, 2d)
|
|
|
|
## [ ] Architecture Refactor (DDD-lite)
|
|
|
|
- [x] Create skeleton packages: `cmd/`, `internal/platform/`, `internal/domain/`, `internal/app/`, `internal/data/`, `internal/adapters/graphql/`, `internal/jobs/`
|
|
- [x] Move infra to `internal/platform/*` (`config`, `db`, `cache`, `auth`, `http`, `log`, `search`)
|
|
- [x] Wire DI in `cmd/api/main.go` and expose an `Application` facade to adapters
|
|
- [x] Unify GraphQL under `internal/adapters/graphql` and update `gqlgen.yml`; move `schema.graphqls` and resolvers
|
|
- [ ] Resolvers call application services only; add dataloaders per aggregate
|
|
- [x] Introduce Unit-of-Work: `platform/db.WithTx(ctx, func(ctx) error)` and repo factory for `*sql.DB` / `*sql.Tx`
|
|
- [x] Split write vs read paths for `work` (commands.go, queries.go); make read models cacheable
|
|
- [ ] Replace bespoke cached repositories with decorators in `internal/data/cache` (reads only; deterministic invalidation)
|
|
- [x] Restructure `models/*` into domain aggregates with constructors and invariants
|
|
- [ ] Adopt migrations tool (goose/atlas/migrate); move SQL to `internal/data/migrations`; delete `migrations.go`
|
|
- [ ] Observability: centralize logging; add Prometheus metrics and OpenTelemetry tracing; request IDs
|
|
- [ ] Config: replace ad-hoc config with env parsing + validation (e.g., koanf/envconfig); no globals
|
|
- [x] Security: move JWT/middleware to `internal/platform/auth`; add authz policy helpers (e.g., `CanEditWork`)
|
|
- [x] Search: move Weaviate client/schema to `internal/platform/search`, optional domain interface
|
|
- [x] Background jobs: move to `cmd/worker` and `internal/jobs/*`; ensure idempotency and lease
|
|
- [x] Python ops: move scripts to `/ops/migration` and `/ops/analysis`; keep outputs under `/ops/migration/outputs/`
|
|
- [x] Cleanup: delete dead packages (`store`, duplicate `repositories`); consolidate to `internal/data/sql`
|
|
- [ ] CI: add `make lint test test-integration` and integration tests with Docker compose
|
|
|
|
## [ ] Testing
|
|
|
|
- [ ] Add unit tests for all models, repositories, and services (High, 3d)
|
|
- [x] Add integration tests for GraphQL API and background jobs (High, 3d) - *Partially complete. Core mutations are tested.*
|
|
- [ ] Add performance benchmarks for critical paths (Medium, 2d)
|
|
- [ ] Add benchmarks for text analysis (sequential vs concurrent) and cache hit/miss rates
|
|
|
|
## [ ] Monitoring & Logging
|
|
|
|
- [ ] Add monitoring for background jobs and API endpoints (Medium, 2d)
|
|
- [ ] Add metrics for linguistics: analysis duration, cache hit/miss, provider usage
|
|
|
|
## [ ] Next Objective Proposal
|
|
|
|
- [x] Stabilize non-linguistics tests and interfaces (High, 2d)
|
|
- [x] Fix `graph` mocks to accept context in service interfaces
|
|
- [x] Update `repositories` tests (missing `TestModel`) and align with new repository interfaces
|
|
- [x] Update `services` tests to pass context and implement missing repo methods in mocks
|
|
- [ ] Add performance benchmarks and metrics for linguistics (Medium, 2d)
|
|
- [ ] Benchmarks for AnalyzeText (provider on/off, concurrency levels)
|
|
- [ ] Export metrics and dashboards for analysis duration and cache effectiveness
|
|
- [ ] Documentation (Medium, 1d)
|
|
- [ ] Document NLP provider toggles and defaults in README/config docs
|
|
- [ ] Describe SRP/DRY design and extension points for new providers
|
|
|
|
---
|
|
|
|
> TODO items include context, priority, and estimated effort. Update this list after each milestone.
|