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
This commit is contained in:
JakkrapartXD 2026-02-11 13:03:40 +07:00
parent 0afbd3f08b
commit 623f797763

View file

@ -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)