<aside>

</aside>

Persistence Model

Table practice_submissions 
{
  id                  uuid                      [pk]
  type                practice_submission_type  [not null]
  user_id             uuid                      [ref: > users.id, note: 'Học viên nộp']  
  lesson_id           uuid                      [ref: > practice_lessons.lesson_id, note: 'Lesson practice']
  submitted_at        timestamp                 [not null, default: `now()`, note: 'Thời điểm nộp']
  is_passed           bool                      [note: 'Đạt qua không']  
  passed_at           timestamp                 [note: 'Thời điểm đạt'] 

  created_at          timestamp                 [default: `now()`]  
  updated_at          timestamp                 [default: `now()`]  
  deleted_at          timestamp                 [null]
}

Table practice_submission_files [note: 'Lưu file upload của learner cho practice'] 
{
  id                  uuid                      [pk, ref: > practice_submissions.id, note: 'ID nộp file (upload)']  
  file_url            varchar                   [note: 'Link file đính kèm']  
  file_name           varchar                   [note: 'Tên file gốc']  
  score               int                       [note: 'Điểm chấm']  
  comment             text                      [note: 'Nhận xét người chấm']  
}
Table practice_writing_submission [note: 'Lưu essay text của learner cho practice'] 
{
  id                  uuid                      [pk, ref: > practice_submissions.id, note: 'ID nộp writing']  
  content             text                      [note: 'Nội dung nộp (essay)']  
  score               int                       [note: 'Điểm chấm']   
  comment             text                      [note: 'Nhận xét người chấm']  
}
Table practice_code_submissions [note: 'Lưu code submission và kết quả tự động chạy test'] 
{
  id                  uuid                          [pk, ref: > practice_submissions.id, note: 'ID nộp code']  
  code_snippet        text                          [not null, note: 'Đoạn code học viên viết']  
  language            supported_programing_language [not null, note: 'Ngôn ngữ lập trình']  
  submission_detail   json                          [note: 'Chi tiết kết quả test case']  
  submission_result   code_submission_result        [note: 'Kết quả chung (passed/wrong)']  
  runtime_ms          int                           [note: 'Thời gian chạy (ms)']  
}

Domain Use Cases

Submit File Command

Submit Code Command

Submit Writing Command

Remove Submission Command

Grade Submission Command

Get Submission Detail Query

Get Submissions By User And Course Query

Get Submissions By Lesson Query