hezarfen_backend
Clone
https://git.tahinli.com/archive/hezarfen_backend.git
0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits
| 1 | //! Exam-question authoring rules: the freeze pre-flight every authoring path |
| 2 | //! runs, the question-lookup and option-addressing gates, and the read and |
| 3 | //! write funnels the web layer goes through. The queries and their |
| 4 | //! transactions live in [`crate::db::exam_question`]; the HTTP shaping stays |
| 5 | //! in the web layer. |
| 6 | |
| 7 | use crateDatabase; |
| 8 | use crateBankQuestionId; |
| 9 | use crateExamId; |
| 10 | use crate |
| 11 | |
| 12 | ; |
| 13 | use crateSubjectId; |
| 14 | use crate; |
| 15 | |
| 16 | /// The questions freeze once anyone has started an attempt — editing them |
| 17 | /// under a student mid-exam would fork what "the exam" means. |
| 18 | pub async |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | /// The question's option named by `choice_id` — a 400 for a text question or an |
| 28 | /// id the question doesn't have, so an option picture can only ever be |
| 29 | /// addressed through an option that exists. |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | /// The question, provided it belongs to `exam` — a qid under someone else's |
| 48 | /// exam is a plain 404, not a leak. |
| 49 | pub async |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | /// Add a question to an exam. The freeze gate and the subject's reference |
| 64 | /// counter ride in the write's own transaction. |
| 65 | pub async |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | /// Like [`create`], but records the bank template the question was |
| 77 | /// instantiated from. |
| 78 | pub async |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | /// The exam's questions in presentation order — the web layer's paging read. |
| 91 | pub async |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | /// The question ids of `exam` sharing a bank template with a question under |
| 101 | /// one of `live` — the review hiding key. |
| 102 | pub async |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | /// Write the editable fields; a stale read is a 409, nothing was written. |
| 111 | pub async |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | /// Delete the question and cascade its answers and image rows. |
| 123 | pub async |
| 124 | |
| 125 | |
| 126 | |
| 127 | /// Point the question's `banked_as` at the bank template it was saved into. |
| 128 | pub async |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 |