hezarfen_backend
Clone
https://git.tahinli.com/archive/hezarfen_backend.git
0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits
| 1 | //! Solution funnels: the offer (through the question's existence-move), the |
| 2 | //! question-scoped read and page, the grouped counts, and the unconditional |
| 3 | //! body/image writes of an unmoderated row. The queries live in |
| 4 | //! [`crate::db::solution`]; the pure entity and newtypes in |
| 5 | //! [`crate::domain::solution`]. |
| 6 | |
| 7 | use HashMap; |
| 8 | |
| 9 | use crateDatabase; |
| 10 | use cratesolution; |
| 11 | use crateFileContentType; |
| 12 | use cratePoolQuestionId; |
| 13 | use crate; |
| 14 | use crateAppError; |
| 15 | |
| 16 | /// Offer the solution; `NotFound` = the question is gone, and nothing was |
| 17 | /// written. |
| 18 | pub async |
| 19 | |
| 20 | |
| 21 | |
| 22 | /// Read a solution only if it belongs to `question` — keeps the nested |
| 23 | /// route honest (a solution id under someone else's question 404s). |
| 24 | pub async |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | /// The question's solutions, oldest first. |
| 33 | pub async |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | /// Per-question solution tallies for a page of questions, in one grouped |
| 43 | /// query. |
| 44 | pub async |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | /// Replace the body; `None` only means the row was deleted mid-flight. |
| 52 | pub async |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | /// Point the solution at a freshly written image blob; `None` means the row |
| 61 | /// was deleted mid-flight (the fresh blob is the caller's orphan to take |
| 62 | /// back off disk). `Some(replaced)` names the blob this upload displaced — |
| 63 | /// the caller's to remove. |
| 64 | pub async |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | /// Detach the solution's image; `None` means the row was deleted mid-flight. |
| 75 | /// `Some(detached)` names the removed blob — `None` inside when there was no |
| 76 | /// image. |
| 77 | pub async |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | /// Delete a solution; the pair carries the row and the blob name of the |
| 85 | /// photo it carried (the caller's disk-GC list). `None` = already gone. |
| 86 | pub async |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 |