feat: Expand domain models and implement full DTO to domain mapping

This commit significantly expands the domain models to fully represent the quiz structure and implements the complete mapping logic in `QuizMapper` to convert `QuizResponseDto` and its nested DTOs to their corresponding domain models.

Key changes:

- **Domain Layer (`domain` module):**
    - Introduced a `QuizId` value class for type safety.
    - Added comprehensive domain models for all aspects of a quiz, including:
        - `Quiz`: Updated to include all fields from the DTO.
        - `Question`, `Choice`, `Video`, `ImageMetadata`, `MediaItem`, `ChoiceRange`: For question details.
        - `CoverMetadata`, `ExtractedColor`, `Crop`, `Point`: For cover image information.
        - `ContentTags`: For curriculum and generated codes.
        - `Metadata`, `Access`, `FeaturedListMembership`, `LastEdit`, `VersionMetadata`: For quiz metadata.
        - `LanguageInfo`, `Channel`: Common reusable models.
    - Organized domain models into separate files for better maintainability (e.g., `Question.kt`, `CoverMetadata.kt`).
    - Added a placeholder `QuestionModels.kt` to indicate that models were moved.
- **Data Layer (`model:data` module):**
    - Implemented a complete `toDomainModel()` extension function in `QuizMapper.kt` to map all fields from `QuizResponseDto` and its nested DTOs (like `CoverMetadataDto`, `QuestionDto`, etc.) to the new domain models.
    - This includes mapping for lists and nullable fields.
- **App Module (`app` module):**
    - Updated `MainActivity` to access `quizId.value` due to `QuizId` being a value class.
- **Network Layer (`core:network` module):**
    - Changed `QuizResponseDto.uuid` to be non-nullable (`String`) as it's essential for mapping to `QuizId`.
    - Removed `QuizResponse.kt` as DTOs were previously split into individual files.
This commit is contained in:
GitHub Actions Bot
2025-09-03 12:45:53 +02:00
parent 293b7f75b9
commit fd0678c1fd
27 changed files with 417 additions and 18 deletions

View File

@@ -1,10 +0,0 @@
package dev.adriankuta.kahootquiz.core.network.models
// This file used to contain all DTOs in one place.
// The DTOs have been split into separate files for maintainability:
// - QuizResponseDto.kt
// - CommonDtos.kt
// - CoverDtos.kt
// - QuestionDtos.kt
// - MetadataDtos.kt
// Keeping this file as a placeholder to avoid breaking any imports by file path (package remains the same).

View File

@@ -4,7 +4,7 @@ import com.google.gson.annotations.SerializedName
// Root response for a Kahoot quiz details (network layer DTO)
data class QuizResponseDto(
val uuid: String?,
val uuid: String,
val language: String?,
val creator: String?,
@SerializedName("creator_username") val creatorUsername: String?,