mirror of
https://github.com/SamyRai/tercul-backend.git
synced 2025-12-27 00:31:35 +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.
3.7 KiB
3.7 KiB
TODO List for Tercul Go Application
[ ] Performance Improvements
- Implement batching for Weaviate operations (Medium, 2d)
[ ] Security Enhancements
- 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)
- Create skeleton packages:
cmd/,internal/platform/,internal/domain/,internal/app/,internal/data/,internal/adapters/graphql/,internal/jobs/ - Move infra to
internal/platform/*(config,db,cache,auth,http,log,search) - Wire DI in
cmd/api/main.goand expose anApplicationfacade to adapters - Unify GraphQL under
internal/adapters/graphqland updategqlgen.yml; moveschema.graphqlsand resolvers - Resolvers call application services only; add dataloaders per aggregate
- Introduce Unit-of-Work:
platform/db.WithTx(ctx, func(ctx) error)and repo factory for*sql.DB/*sql.Tx - 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) - Restructure
models/*into domain aggregates with constructors and invariants - Adopt migrations tool (goose/atlas/migrate); move SQL to
internal/data/migrations; deletemigrations.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
- Security: move JWT/middleware to
internal/platform/auth; add authz policy helpers (e.g.,CanEditWork) - Search: move Weaviate client/schema to
internal/platform/search, optional domain interface - Background jobs: move to
cmd/workerandinternal/jobs/*; ensure idempotency and lease - Python ops: move scripts to
/ops/migrationand/ops/analysis; keep outputs under/ops/migration/outputs/ - Cleanup: delete dead packages (
store, duplicaterepositories); consolidate tointernal/data/sql - CI: add
make lint test test-integrationand integration tests with Docker compose
[ ] Testing
- Add unit tests for all models, repositories, and services (High, 3d)
- 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
- Stabilize non-linguistics tests and interfaces (High, 2d)
- Fix
graphmocks to accept context in service interfaces - Update
repositoriestests (missingTestModel) and align with new repository interfaces - Update
servicestests to pass context and implement missing repo methods in mocks
- Fix
- 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.