Welcome to answer
Your guide to understanding the codebase
Learning Path
17 units • 5 levels
Orchestration & APIs
- Pipelines, workflows, public interfaces • 4 units
- HTTP Layer & API Basics
- HTTP Server & Request Handling
- Application Architecture & Setup
- Data Layer Fundamentals
Core Logic & Data
- Business rules, schemas, models • 3 units
- Frontend Integration
- Dependency Injection & Service Layer
- Security & Access Control
Interaction & Integration
- UI components, external connectors • 3 units
- Integration & External Services
- Activity & Notification Pipeline
- Content Management Systems
Cross-Cutting Concerns
- Auth, logging, config, testing • 2 units
- Production Deployment & Operations
- Moderation & Review Systems
- Edge Cases & Resilience
Additional Data Model Patterns
- Additional Error Handling Patterns
Test Your Knowledge
Test your deep understanding of the codebase
Your Challenge
Add a content versioning system that tracks changes to answers over time. When users edit their answers, the system should save the previous version before applying the update, allowing users to view edit history and optionally revert to a previous version. This will help with transparency and allow recovery from accidental edits or vandalism.
Starting Points
cmd/command.go:1-87
Examine how the application initializes services and database connections. You'll need to understand the service layer pattern used here.Dockerfile:1-75
Review the application structure and how migrations are handled. You may need to create a new migration for the version history table.docs/swagger.json:1-96
Study the existing API structure and response formats. Your new endpoints should follow the same patterns for consistency.charts/values.yaml:1-104
Understand the deployment configuration. Consider how version history might impact storage and database performance in production.
Success Criteria
- A new database table stores answer versions with all necessary fields and proper foreign key constraints
- Every answer edit creates a version record before applying the update
- API endpoint returns paginated version history for a given answer
- Users can view the content of any previous version without affecting the current answer
- Answer authors can revert to a previous version, which itself creates a new version entry
- Unauthorized users cannot revert answers they don't own (returns 403 Forbidden)
- The application builds successfully: go build ./cmd/...
- Database migrations run without errors
Hints
- Understanding the data layer conceptual
- Where updates happen code location
- Database schema considerations implementation
- API design approach implementation
- Transaction safety implementation
Prerequisites
- Database schema design and migrations
- Repository pattern
- RESTful API design
- Database transactions
- Authorization and access control