hezarfen_backend
Clone
https://git.tahinli.com/archive/hezarfen_backend.git
0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits
| 1 | //! A school fee plan: a name and the installments it is paid in. Managers |
| 2 | //! write them; assigning one to a student is what turns it into money owed |
| 3 | //! (see [`crate::domain::fee_plan_assignment`]). |
| 4 | //! |
| 5 | //! The installments are **embedded** on the plan row rather than child rows: |
| 6 | //! a charge line copies the amount and due date it was assigned at, so the |
| 7 | //! installment is a template, never a thing that has to be joined back to. |
| 8 | //! The embedded list rides a `JSONB` column in stored order. |
| 9 | //! |
| 10 | //! Due dates may be in the **past**: a school adopting the app mid-year |
| 11 | //! legitimately assigns a plan whose first installments were already due, so |
| 12 | //! the no-past rule that guards exams, lessons and events deliberately does not |
| 13 | //! apply here. |
| 14 | |
| 15 | use Json; |
| 16 | |
| 17 | use crate; |
| 18 | use cratenext_uuid; |
| 19 | use crateLedgerAmount; |
| 20 | use crateTimestamp; |
| 21 | use crateUserId; |
| 22 | use crateValidationError; |
| 23 | use cratevalidate_required; |
| 24 | |
| 25 | |
| 26 | |
| 27 | ; |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | ; |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | /// One instalment of a plan: what is owed, and when it falls due. Both fields |
| 69 | /// are required, so the stored JSON shape always matches the written one. |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | /// A plan is at least one installment and at most [`MAX_FEE_PLAN_INSTALLMENTS`] |
| 94 | /// — an empty plan owes nothing and would assign nothing, and the ceiling is |
| 95 | /// what bounds how many ledger lines one assignment may append. |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 |