Commit graph

9 commits

Author SHA1 Message Date
Lasse Rune Hansen
242d5ea60b feat(backend): Complete Quiz System implementation
- Add Quiz entity with full domain logic (Create, Update, Activate, Deactivate)
- Add QuizQuestion entity updated to use QuizId instead of LessonId
- Add QuizRepository with all CRUD and query methods
- Add QuizQuestionRepository with QuizId-based and LessonId-based (legacy) methods
- Add QuizDto, CreateQuizDto, UpdateQuizDto, QuizWithQuestionsDto, QuizListItemDto
- Add QuizQuestionDto updated with QuizId, LessonId, QuizTitle, Points fields
- Add CreateQuizCommand, UpdateQuizCommand, DeleteQuizCommand, GetQuizWithQuestionsCommand
- Add QuizService with full quiz management (CRUD, activate, deactivate, counts, queries)
- Add QuizQuestionService updated with QuizId-based methods
- Add QuizzesController with comprehensive endpoints (GET, POST, PUT, DELETE)
- Add QuizzesController endpoints for quiz questions (by-quiz, random, active)
- Update QuizQuestionsController with new QuizId-based endpoints (backward compatible)
- Register QuizRepository and QuizService in DI container
- Update IRepository interfaces with QuizId-based methods
- Add SubmitQuizDto for quiz answer submission

Clean Architecture layers maintained:
- Domain: Quiz, QuizQuestion entities with business logic
- Application: DTOs, Commands, Services
- Infrastructure: Repositories, DbContext
- Presentation: Controllers

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-13 07:41:46 +02:00
Lasse Rune Hansen
04ad7ef008 feat(backend/domain): add quiz question feature with Docker migration support
- Add QuizQuestion and QuizOption domain entities with QuestionType enum
- Add IQuizQuestionRepository and IQuizOptionRepository interfaces
- Add QuizQuestionRepository and QuizOptionRepository EF Core implementations
- Add QuizQuestionService with CRUD, quiz submission, and statistics
- Add QuizQuestionsController with comprehensive REST API endpoints
- Add QuizQuestionDto and related DTOs for API communication
- Add EF Core migration (20260612050652_AddQuizQuestionTables) for QuizQuestion and QuizOption
- Add seed data with sample quiz questions for Greetings, Numbers, Grammar lessons
- Update AppDbContext with DbSets and entity configurations
- Update Program.cs with migration retry logic for Docker
- Update docker-compose.yml with SeedDatabase configuration
- Add unit tests for QuizQuestionService

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-12 16:49:27 +02:00
Lasse Rune Hansen
a6021fb148 feat(backend/validation): add FluentValidation for DTOs and update controllers
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- Add FluentValidation.AspNetCore package
- Create LevelValidators (CreateLevelValidator, UpdateLevelValidator)
- Create LessonValidators (CreateLessonValidator, UpdateLessonValidator)
- Register FluentValidation in Program.cs with auto-validation
- Update LevelsController and LessonsController to use IActionResult
- Make service methods virtual for Moq testing compatibility
- Add 26 integration tests for LevelsController (13 tests)
- Add 34 integration tests for LessonsController (17 tests)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-09 17:35:14 +02:00
Lasse Rune Hansen
3caee4c21e feat(backend/presentation): add LevelsController and LessonsController for Lesson Management
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- Created LevelsController.cs with full CRUD operations
  - GET /api/levels - all levels
  - GET /api/levels/{id} - level by ID
  - GET /api/levels/by-code/{code} - level by code
  - GET /api/levels/first - first level
  - GET /api/levels/next/{id} - next level
  - POST /api/levels - create level (Admin)
  - PUT /api/levels/{id} - update level (Admin)
  - DELETE /api/levels/{id} - delete level (Admin)

- Created LessonsController.cs with full CRUD and filtering
  - GET /api/lessons - all lessons
  - GET /api/lessons/ordered - ordered lessons
  - GET /api/lessons/{id} - lesson by ID
  - GET /api/lessons/by-level/{levelId} - lessons by level
  - GET /api/lessons/beginner - beginner lessons
  - GET /api/lessons/advanced - advanced lessons
  - GET /api/lessons/first/{levelId} - first lesson in level
  - GET /api/lessons/next/{id} - next lesson
  - GET /api/lessons/accessible/{userId} - accessible lessons
  - GET /api/lessons/unlocked/{userId}/{lessonId} - check unlock
  - POST /api/lessons - create lesson (Admin)
  - PUT /api/lessons/{id} - update lesson (Admin)
  - DELETE /api/lessons/{id} - delete lesson (Admin)

- Added authorization: [Authorize] for most endpoints, [AllowAnonymous] for read-only
- Added Admin role requirement for write operations

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-09 07:20:29 +02:00
Lasse Rune Hansen
ba81359afa fix(backend): update Lesson entity and related code to use LevelId foreign key
- Updated Lesson entity to use LevelId (int) instead of Level (int)
- Added navigation property Level (Level entity)
- Added Order, Topic, and IsActive properties to Lesson
- Updated Lesson.Create() factory method signature to accept levelId, title, order, topic, description
- Split Update method into individual property update methods
- Updated LessonDto to use LevelId, LevelName, LevelCode instead of Level int
- Added CreateLessonDto and UpdateLessonDto with all required fields
- Added UpdateFromDto extension method for Lesson
- Updated CreateLessonCommand to validate LevelId instead of Level
- Updated SeedDataExtension to seed Level entities first, then use new Lesson.Create() signature
- Made SeedDatabaseAsync async and updated Program.cs to await it
- Updated LessonsEndpoints to use GetByLevelAsync for beginner/advanced queries
- Fixed missing using directive for Domain.Entities

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-07 21:25:46 +02:00
Lasse Rune Hansen
6bcf592918 feat(backend): complete unit tests for User Authentication feature
- Fix MSTest compatibility with .NET 9.0 by upgrading to MSTest.TestFramework 4.2.3
- Move Tests directory to solution level (Tests/) to prevent test files from being compiled with GermanApp
- Update test project references to point to GermanApp/GermanApp.csproj
- Add InternalsVisibleTo attributes for test assemblies
- Make RefreshToken properties internal for testability
- Fix User.ChangeEmail null handling
- Add 46 comprehensive unit tests for User and RefreshToken domain entities
- All tests passing successfully

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-05 17:07:15 +02:00
Lasse Rune Hansen
3c33253cba feat(backend/auth): add authorization to Lessons endpoints
- Add RequireAuthorization() to POST, PUT, DELETE endpoints
- Add Microsoft.AspNetCore.Authorization using
- Lessons now require JWT token for create, update, delete

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-05 15:03:15 +02:00
Lasse Rune Hansen
d508d498c0 feat(backend/auth): implement User Authentication feature
- Add DTOs: RegisterDto, LoginDto, AuthResponse
- Add IAuthService interface
- Implement AuthService with JWT token generation
- Create AuthController with register, login, me endpoints
- Add JWT configuration to appsettings.json
- Configure JWT Bearer authentication in Program.cs
- Add PasswordHasher for custom User entity
- Update User entity with ChangePassword method
- Add necessary NuGet packages for JWT auth

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-06-05 13:27:43 +02:00
Lasse Rune Hansen
d90e4792d6 Initial commit: GermanApp with Clean Architecture
- Domain layer: Lesson entity, GermanWord value object, repository interfaces
- Application layer: CQRS commands, DTOs with mapping
- Infrastructure layer: EF Core with SQLite, LessonRepository
- Presentation layer: Minimal API endpoints for lessons CRUD

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-05-31 18:14:51 +02:00