Skip to content

Commit 935bbba

Browse files
marypas74claude
andcommitted
feat: Add Student Learning Space DTOs (v2.1.0)
Complete DTO layer for Student Learning Space features, enabling API endpoints for AI-powered learning assistance, video annotations, and transcript search. DTOs Added (5 files): 1. AIChat DTOs (2 files): - AIChatMessageDto: Request DTO with lesson context and video timestamp - AIChatResponseDto: Response with context metadata and token usage - AIContextInfoDto: Context tracking (transcript used, notes used) 2. AITakeaways DTOs (1 file): - VideoKeyTakeawaysDto: AI-generated key points from video lessons - TakeawayDto: Individual takeaway with category and relevance score - TakeawayMetadataDto: Processing metadata 3. VideoBookmarks DTOs (1 file): - VideoBookmarkDto: Bookmark response with timestamp and label - CreateVideoBookmarkDto: Bookmark creation with validation - UpdateVideoBookmarkDto: Bookmark label update 4. VideoTranscript DTOs (1 file): - TranscriptSearchResultDto: Search results with match count - TranscriptSearchMatchDto: Individual match with relevance score Features Enabled: - AI chatbot with lesson-aware responses - Video timestamp-based annotations - AI-generated key takeaways with categories - Video bookmarks (manual and AI-generated) - Full-text transcript search with highlighting Validation: - All input DTOs have comprehensive DataAnnotations - String length limits prevent DoS attacks - Range validation on numeric fields - Regex validation on enum-like string fields Related: - Entities: StudentNote, VideoBookmark, VideoTranscriptMetadata, AIKeyTakeawaysMetadata, AIConversation - Migration: 20251119000000_AddStudentLearningSpaceEntities - Database: 54 tables operational 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent aa9ff84 commit 935bbba

File tree

5 files changed

+235
-0
lines changed

5 files changed

+235
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.ComponentModel.DataAnnotations;
3+
4+
namespace InsightLearn.Core.DTOs.AIChat
5+
{
6+
/// <summary>
7+
/// DTO for sending a message to AI chatbot.
8+
/// Part of Student Learning Space v2.1.0.
9+
/// </summary>
10+
public class AIChatMessageDto
11+
{
12+
[Required(ErrorMessage = "Message content is required")]
13+
[StringLength(2000, MinimumLength = 1, ErrorMessage = "Message must be between 1 and 2000 characters")]
14+
public string Message { get; set; } = string.Empty;
15+
16+
/// <summary>
17+
/// Session ID for conversation continuity.
18+
/// If null, a new session will be created.
19+
/// </summary>
20+
public Guid? SessionId { get; set; }
21+
22+
/// <summary>
23+
/// Optional lesson context for AI responses.
24+
/// </summary>
25+
public Guid? LessonId { get; set; }
26+
27+
/// <summary>
28+
/// Current video timestamp (in seconds) for contextual responses.
29+
/// </summary>
30+
[Range(0, int.MaxValue, ErrorMessage = "Video timestamp must be non-negative")]
31+
public int? VideoTimestamp { get; set; }
32+
}
33+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System;
2+
3+
namespace InsightLearn.Core.DTOs.AIChat
4+
{
5+
/// <summary>
6+
/// AI chatbot response DTO.
7+
/// Part of Student Learning Space v2.1.0.
8+
/// </summary>
9+
public class AIChatResponseDto
10+
{
11+
public Guid SessionId { get; set; }
12+
public string Response { get; set; } = string.Empty;
13+
14+
/// <summary>
15+
/// Timestamp when response was generated.
16+
/// </summary>
17+
public DateTime Timestamp { get; set; }
18+
19+
/// <summary>
20+
/// Context used for generating the response.
21+
/// </summary>
22+
public AIContextInfoDto? Context { get; set; }
23+
}
24+
25+
/// <summary>
26+
/// Context information used by AI for response generation.
27+
/// </summary>
28+
public class AIContextInfoDto
29+
{
30+
public Guid? LessonId { get; set; }
31+
public int? VideoTimestamp { get; set; }
32+
public bool TranscriptUsed { get; set; }
33+
public bool NotesUsed { get; set; }
34+
public int TokensUsed { get; set; }
35+
}
36+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace InsightLearn.Core.DTOs.AITakeaways
5+
{
6+
/// <summary>
7+
/// AI-generated key takeaways for a video lesson.
8+
/// Part of Student Learning Space v2.1.0.
9+
/// </summary>
10+
public class VideoKeyTakeawaysDto
11+
{
12+
public Guid LessonId { get; set; }
13+
14+
/// <summary>
15+
/// List of AI-extracted key takeaways.
16+
/// </summary>
17+
public List<TakeawayDto> Takeaways { get; set; } = new();
18+
19+
/// <summary>
20+
/// Processing metadata.
21+
/// </summary>
22+
public TakeawayMetadataDto? Metadata { get; set; }
23+
}
24+
25+
/// <summary>
26+
/// Single key takeaway with category and relevance.
27+
/// </summary>
28+
public class TakeawayDto
29+
{
30+
public string TakeawayId { get; set; } = string.Empty;
31+
public string Text { get; set; } = string.Empty;
32+
33+
/// <summary>
34+
/// Category: CoreConcept, BestPractice, Example, Warning, Summary.
35+
/// </summary>
36+
public string Category { get; set; } = "CoreConcept";
37+
38+
/// <summary>
39+
/// AI relevance score (0.0 - 1.0).
40+
/// </summary>
41+
public double RelevanceScore { get; set; }
42+
43+
public double? TimestampStart { get; set; }
44+
public double? TimestampEnd { get; set; }
45+
46+
/// <summary>
47+
/// User feedback (thumbs up/down).
48+
/// </summary>
49+
public int? UserFeedback { get; set; }
50+
}
51+
52+
/// <summary>
53+
/// Takeaway processing metadata.
54+
/// </summary>
55+
public class TakeawayMetadataDto
56+
{
57+
public int TotalTakeaways { get; set; }
58+
public string ProcessingModel { get; set; } = string.Empty;
59+
public DateTime ProcessedAt { get; set; }
60+
}
61+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using System;
2+
using System.ComponentModel.DataAnnotations;
3+
4+
namespace InsightLearn.Core.DTOs.VideoBookmarks
5+
{
6+
/// <summary>
7+
/// Video bookmark response DTO.
8+
/// Part of Student Learning Space v2.1.0.
9+
/// </summary>
10+
public class VideoBookmarkDto
11+
{
12+
public Guid Id { get; set; }
13+
public Guid UserId { get; set; }
14+
public Guid LessonId { get; set; }
15+
16+
/// <summary>
17+
/// Video timestamp in seconds.
18+
/// </summary>
19+
public int VideoTimestamp { get; set; }
20+
21+
/// <summary>
22+
/// Optional custom label.
23+
/// </summary>
24+
public string? Label { get; set; }
25+
26+
/// <summary>
27+
/// Manual (user-created) or Auto (AI-generated from key takeaways).
28+
/// </summary>
29+
public string BookmarkType { get; set; } = "Manual";
30+
31+
public DateTime CreatedAt { get; set; }
32+
}
33+
34+
/// <summary>
35+
/// DTO for creating a video bookmark.
36+
/// </summary>
37+
public class CreateVideoBookmarkDto
38+
{
39+
[Required(ErrorMessage = "Lesson ID is required")]
40+
public Guid LessonId { get; set; }
41+
42+
[Required(ErrorMessage = "Video timestamp is required")]
43+
[Range(0, int.MaxValue, ErrorMessage = "Video timestamp must be non-negative")]
44+
public int VideoTimestamp { get; set; }
45+
46+
[StringLength(200, ErrorMessage = "Label must be 200 characters or less")]
47+
public string? Label { get; set; }
48+
49+
/// <summary>
50+
/// Bookmark type: Manual or Auto.
51+
/// Default: Manual.
52+
/// </summary>
53+
[RegularExpression("^(Manual|Auto)$", ErrorMessage = "Bookmark type must be Manual or Auto")]
54+
public string BookmarkType { get; set; } = "Manual";
55+
}
56+
57+
/// <summary>
58+
/// DTO for updating a video bookmark.
59+
/// </summary>
60+
public class UpdateVideoBookmarkDto
61+
{
62+
[StringLength(200, ErrorMessage = "Label must be 200 characters or less")]
63+
public string? Label { get; set; }
64+
}
65+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace InsightLearn.Core.DTOs.VideoTranscript
5+
{
6+
/// <summary>
7+
/// Transcript search result DTO.
8+
/// Part of Student Learning Space v2.1.0.
9+
/// </summary>
10+
public class TranscriptSearchResultDto
11+
{
12+
public Guid LessonId { get; set; }
13+
public string Query { get; set; } = string.Empty;
14+
15+
/// <summary>
16+
/// Total number of matches found.
17+
/// </summary>
18+
public int TotalMatches { get; set; }
19+
20+
/// <summary>
21+
/// List of matching segments with context.
22+
/// </summary>
23+
public List<TranscriptSearchMatchDto> Matches { get; set; } = new();
24+
}
25+
26+
/// <summary>
27+
/// Single search match with highlighted text.
28+
/// </summary>
29+
public class TranscriptSearchMatchDto
30+
{
31+
public double Timestamp { get; set; }
32+
public string Text { get; set; } = string.Empty;
33+
public string? Speaker { get; set; }
34+
35+
/// <summary>
36+
/// Relevance score (0.0 - 1.0).
37+
/// </summary>
38+
public double RelevanceScore { get; set; }
39+
}
40+
}

0 commit comments

Comments
 (0)