feat: Update lesson query to filter by course through modules and implement Default for the Lesson struct.

This commit is contained in:
2026-03-06 13:05:41 -03:00
parent 997af5d473
commit bf3f06d831
2 changed files with 30 additions and 1 deletions
+29
View File
@@ -64,6 +64,7 @@ pub struct Module {
}
#[derive(Debug, Serialize, Deserialize, sqlx::FromRow, Clone)]
#[sqlx(default)]
pub struct Lesson {
pub id: Uuid,
pub organization_id: Uuid,
@@ -88,6 +89,34 @@ pub struct Lesson {
pub created_at: DateTime<Utc>,
}
impl Default for Lesson {
fn default() -> Self {
Self {
id: Uuid::new_v4(),
organization_id: Uuid::new_v4(),
module_id: Uuid::new_v4(),
title: String::new(),
content_type: String::new(),
content_url: None,
summary: None,
transcription: None,
metadata: None,
grading_category_id: None,
is_graded: false,
max_attempts: None,
allow_retry: false,
position: 0,
due_date: None,
important_date_type: None,
transcription_status: None,
video_generation_status: None,
video_generation_error: None,
is_previewable: false,
created_at: Utc::now(),
}
}
}
#[derive(Debug, Serialize, Deserialize, sqlx::FromRow, Clone)]
pub struct GradingCategory {
pub id: Uuid,