Implement story integration foundation: - Create Domain/Entities/StorySegment.cs with full CRUD methods - Create Domain/Entities/StoryProgress.cs for user story progress tracking - Create Application/DTOs/StorySegmentDto.cs with multiple DTO types - Create Domain/Interfaces/IStoryRepository.cs - Create Domain/Interfaces/IStoryProgressRepository.cs - Create Infrastructure/Data/Repositories/StoryRepository.cs - Create Infrastructure/Data/Repositories/StoryProgressRepository.cs - Add DbSets and entity configurations to AppDbContext - Add navigation properties to Level, Lesson, and User entities Next: Phase 2 - Backend Services (StoryService, StoryGenerationService) Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
104 lines
2.4 KiB
C#
104 lines
2.4 KiB
C#
namespace GermanApp.Application.DTOs;
|
|
|
|
/// <summary>
|
|
/// Data Transfer Object for StorySegment.
|
|
/// Used for API requests and responses.
|
|
/// </summary>
|
|
public record StorySegmentDto(
|
|
int Id,
|
|
int LevelId,
|
|
int? LessonId,
|
|
string Content,
|
|
string? AudioUrl,
|
|
int Order,
|
|
string Title,
|
|
string Theme,
|
|
int EstimatedReadingMinutes,
|
|
bool IsActive,
|
|
DateTime CreatedAt,
|
|
DateTime? UpdatedAt)
|
|
{
|
|
/// <summary>
|
|
/// Creates a StorySegmentDto from a domain entity.
|
|
/// </summary>
|
|
public static StorySegmentDto FromEntity(Domain.Entities.StorySegment segment)
|
|
{
|
|
return new StorySegmentDto(
|
|
segment.Id,
|
|
segment.LevelId,
|
|
segment.LessonId,
|
|
segment.Content,
|
|
segment.AudioUrl,
|
|
segment.Order,
|
|
segment.Title,
|
|
segment.Theme,
|
|
segment.EstimatedReadingMinutes,
|
|
segment.IsActive,
|
|
segment.CreatedAt,
|
|
segment.UpdatedAt);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// DTO for creating a new story segment.
|
|
/// </summary>
|
|
public record CreateStorySegmentDto(
|
|
int LevelId,
|
|
int? LessonId,
|
|
string Content,
|
|
int Order,
|
|
string Title,
|
|
string Theme,
|
|
int EstimatedReadingMinutes = 2);
|
|
|
|
/// <summary>
|
|
/// DTO for updating an existing story segment.
|
|
/// </summary>
|
|
public record UpdateStorySegmentDto(
|
|
string? Content = null,
|
|
int? Order = null,
|
|
string? Title = null,
|
|
string? Theme = null,
|
|
int? EstimatedReadingMinutes = null,
|
|
int? LessonId = null,
|
|
bool? IsActive = null);
|
|
|
|
/// <summary>
|
|
/// DTO for generating a story for a level.
|
|
/// </summary>
|
|
public record StoryGenerationRequestDto(
|
|
int LevelId,
|
|
string Theme,
|
|
int SegmentCount,
|
|
string? CustomPrompt = null);
|
|
|
|
/// <summary>
|
|
/// Response DTO for story generation.
|
|
/// </summary>
|
|
public record StoryGenerationResponseDto(
|
|
int LevelId,
|
|
string Theme,
|
|
int SegmentCount,
|
|
string FullStoryText,
|
|
IReadOnlyList<StorySegmentDto> Segments);
|
|
|
|
/// <summary>
|
|
/// DTO for user's story progress.
|
|
/// </summary>
|
|
public record StoryProgressDto(
|
|
int LevelId,
|
|
string LevelName,
|
|
int TotalSegments,
|
|
int UnlockedSegments,
|
|
int CurrentSegmentOrder,
|
|
IReadOnlyList<StorySegmentProgressDto> Segments);
|
|
|
|
/// <summary>
|
|
/// DTO for individual segment progress.
|
|
/// </summary>
|
|
public record StorySegmentProgressDto(
|
|
int SegmentId,
|
|
int Order,
|
|
string Title,
|
|
bool IsUnlocked,
|
|
bool IsCompleted);
|