From 623f797763c38dc562d3b0983b24b2c8bef56d4b Mon Sep 17 00:00:00 2001 From: JakkrapartXD Date: Wed, 11 Feb 2026 13:03:40 +0700 Subject: [PATCH] feat: add is_recommended to Course and allow_multiple_attempts to Quiz - Add is_recommended field to Course model (default: false) - Add allow_multiple_attempts field to Quiz model (default: true) - Create migration: add_recommended_and_quiz_attempts --- Backend/prisma/schema.prisma | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Backend/prisma/schema.prisma b/Backend/prisma/schema.prisma index a4386c8a..212b3bf3 100644 --- a/Backend/prisma/schema.prisma +++ b/Backend/prisma/schema.prisma @@ -137,6 +137,7 @@ model Course { price Decimal @default(0) @db.Decimal(10, 2) is_free Boolean @default(false) have_certificate Boolean @default(false) + is_recommended Boolean @default(false) status CourseStatus @default(DRAFT) approved_by Int? approved_at DateTime? @@ -304,6 +305,7 @@ model Quiz { shuffle_choices Boolean @default(false) show_answers_after_completion Boolean @default(true) is_skippable Boolean @default(true) + allow_multiple_attempts Boolean @default(true) created_at DateTime @default(now()) created_by Int updated_at DateTime? @updatedAt @@ -640,11 +642,11 @@ model AuditLog { action AuditAction entity_type String @db.VarChar(100) // Course, User, Lesson, Quiz, etc. entity_id Int? - old_value Json? // ค่าเดิม (สำหรับ UPDATE/DELETE) - new_value Json? // ค่าใหม่ (สำหรับ CREATE/UPDATE) + old_value Json? // ค่าเดิม (สำหรับ UPDATE/DELETE) + new_value Json? // ค่าใหม่ (สำหรับ CREATE/UPDATE) ip_address String? @db.VarChar(45) // รองรับ IPv6 user_agent String? @db.Text - metadata Json? // ข้อมูลเพิ่มเติม เช่น request_id, session_id + metadata Json? // ข้อมูลเพิ่มเติม เช่น request_id, session_id created_at DateTime @default(now()) user User? @relation(fields: [user_id], references: [id], onDelete: SetNull)