hezarfen_backend
Clone
https://git.tahinli.com/Hezarfen/hezarfen_backend.git
0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits
| 1 | //! The `app_user` table: the row mint (with the duplicate-username mapping), |
| 2 | //! row reads and listings, the role cascade transaction (admin floor and all |
| 3 | //! sweeps included), and the field-scoped writers. The workflow that drives |
| 4 | //! the cascade lives in [`crate::service::user`]. |
| 5 | //! |
| 6 | //! The compile-time macros map columns by name and check each decoded type |
| 7 | //! against the prepare schema, so the eighteen user columns are spelled |
| 8 | //! out — newtype overrides included — in every static statement below. The |
| 9 | //! repetitions are the check. |
| 10 | |
| 11 | use crate; |
| 12 | use crateFieldUpdate; |
| 13 | use crate; |
| 14 | use crate; |
| 15 | use crateFileContentType; |
| 16 | use cratePersonId; |
| 17 | use crate; |
| 18 | use crate; |
| 19 | use crateRole; |
| 20 | use crate; |
| 21 | use crateTimestamp; |
| 22 | use crate; |
| 23 | use crateAppError; |
| 24 | |
| 25 | /// The answer a duplicate `student_number` gets, from both write paths that |
| 26 | /// can raise one (the mint and the profile writer). One spelling so the two |
| 27 | /// cannot drift, and `ConflictCoded` because the frontend branches on the |
| 28 | /// cause — the number is refused by the partial unique index |
| 29 | /// (`app_user_student_number`), not by anything the message could name. |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | /// Register a new school account for the control-plane `person` whose |
| 38 | /// credential login verifies — `person` is the join key, `None` only where the |
| 39 | /// caller cannot know it yet (tests, the boot seed's row-first order — see |
| 40 | /// [`crate::service::user::ensure_admin`]). New users always start as |
| 41 | /// [`Role::Student`]; elevation is a separate, admin-only action |
| 42 | /// (see [`crate::service::user::set_role`]). |
| 43 | pub async |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | /// The one row-minting path. `role` is written *with* the row rather than |
| 52 | /// patched on afterwards, which is what makes the admin seed atomic: a |
| 53 | /// create-then-promote pair can be interrupted between its halves (a SIGKILL, |
| 54 | /// or a cancelled future), and the row left behind is an ordinary student |
| 55 | /// account that [`crate::service::user::ensure_admin`] must then refuse to |
| 56 | /// touch — a deployment with no admin and no way for a later boot to repair it. |
| 57 | /// |
| 58 | /// The unique index on `username` is the whole availability check. The old |
| 59 | /// pre-check-and-recheck dance existed because the old store could not name |
| 60 | /// the constraint a racing insert had violated; here the violated |
| 61 | /// constraint's name answers directly (`app_user_username`), and the loser |
| 62 | /// of a race gets the same 409 the sequential duplicate always got. |
| 63 | /// |
| 64 | /// The row carries its `created_at` mint stamp and, when the caller knows it, |
| 65 | /// the `person` id the credential lives on. `student_number` binds as handed: |
| 66 | /// the *role* rule ("only a student may hold one") is the web layer's gate — |
| 67 | /// it is the layer that resolves the requested role — while the *uniqueness* |
| 68 | /// rule is the partial unique index, and its violation answers the same 409 |
| 69 | /// the duplicate username does. |
| 70 | pub async |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 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 | pub async |
| 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 | /// Every account, newest first — the web layer's paging read — or, when |
| 176 | /// `roles` is `Some`, only the rows whose role is in the set (the admin |
| 177 | /// directory's tabs; `manager,admin` is one OR, not an AND). The narrowing |
| 178 | /// is the `WHERE` itself, so [`PagedList`] counts the filtered set and a |
| 179 | /// later page stays inside it: page and `total` share this one predicate. |
| 180 | pub async |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | /// Fetch the users behind `ids` in one query. Ids with no row are simply |
| 201 | /// absent from the result — the caller decides how to degrade. |
| 202 | pub async |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | /// Every user holding exactly `role` — e.g. the roster of a role-targeted |
| 241 | /// event. Exact match, not `at_least`: "all teachers" means teachers, not |
| 242 | /// managers and admins too. |
| 243 | pub async |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | /// Case- and diacritic-insensitive fragment search over username, name, |
| 278 | /// and surname. Needle and columns both go through |
| 279 | /// [`crate::domain::text_fold`], so `ilker` finds `İLKER` and back — |
| 280 | /// backs the user pickers. `role` narrows to one role (e.g. only students |
| 281 | /// for an enroll picker); `None` searches everyone. `allowed_roles` |
| 282 | /// narrows the *visible* set (the roles a non-staff caller may message — |
| 283 | /// see [`Role::messageable_roles`]); it is part of the query, not a |
| 284 | /// post-filter, so `total` counts only what the caller may see. A blank |
| 285 | /// `query` matches everyone visible: blank alone is the caller's whole |
| 286 | /// directory, blank + `role` a role-scoped listing. Returns |
| 287 | /// every match, ordered by username; the HTTP layer pages the result like |
| 288 | /// any other list (no built-in cap — an over-broad fragment is windowed |
| 289 | /// by `?limit`). |
| 290 | pub async |
| 291 | |
| 292 | |
| 293 | |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | |
| 299 | |
| 300 | |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | |
| 311 | |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | |
| 333 | |
| 334 | |
| 335 | |
| 336 | |
| 337 | |
| 338 | |
| 339 | |
| 340 | |
| 341 | |
| 342 | |
| 343 | |
| 344 | |
| 345 | |
| 346 | |
| 347 | |
| 348 | /// The role write and every sweep it owes, in one transaction — the |
| 349 | /// statement list behind [`crate::service::user::set_role`]; see there for |
| 350 | /// the floor that guards it and the arm-by-arm reasoning. What follows is |
| 351 | /// the store side. |
| 352 | /// |
| 353 | /// Writes *only* the `role` field of the user row — plus `student_number`, |
| 354 | /// cleared in that same statement whenever the new role is not `student` |
| 355 | /// (see the statement's own note) — never the whole row: the row mixes |
| 356 | /// admin-owned (role) and self-service (profile, preferences) fields, and |
| 357 | /// each writer starts from a snapshot read at request start. A whole-row |
| 358 | /// write would carry the snapshot's copy of the *other* group back over a |
| 359 | /// concurrent edit — an in-flight profile save silently reverting an |
| 360 | /// admin's demotion, or this write erasing a profile edit that raced it. |
| 361 | /// [`set_profile`] and [`set_preferences`] are scoped for the same reason. |
| 362 | /// |
| 363 | /// What is swept, and why the conditions differ: |
| 364 | /// |
| 365 | /// * **Non-student** sheds class memberships, *every* enrollment row |
| 366 | /// (hand-placed ones included — only students enroll, and a kept row |
| 367 | /// would grant nothing and count a seat) and the parent links observing |
| 368 | /// them. Memberships and enrollments were already one transaction and |
| 369 | /// still are: released apart, an enrollment row could be left tagged with |
| 370 | /// a class whose counters had been given back, so the class passed its |
| 371 | /// zero-zero delete guard and no sweep could ever reach the row again. |
| 372 | /// * **Parent** additionally frees event seats, comes off every whiteboard |
| 373 | /// roster and has the boards they *created* closed — permanently |
| 374 | /// read-only, rows kept, because a room whose creator is demoted is |
| 375 | /// commandable by nobody at all (see the statement's own note). The seat |
| 376 | /// is the one thing on a signup list nothing |
| 377 | /// else could remove: staff free their own by hand (`unregister` allows |
| 378 | /// the self case) but a parent can reach no such door, so a promotion |
| 379 | /// strands nothing and only this demotion does. A list that has already |
| 380 | /// **frozen** (an audience-`registration` event whose start-or-end time |
| 381 | /// has passed — the same predicate |
| 382 | /// [`crate::domain::registration`]'s Rust check enforces) is left exactly |
| 383 | /// as it stands — past the freeze it is historical record, |
| 384 | /// re-registering answers 409, and rewriting it here would be |
| 385 | /// irrecoverable. A signup whose event record is *gone* has no seat to |
| 386 | /// hand back and no list that can freeze, so it is deleted rather than |
| 387 | /// skipped: skipped, it is stranded forever (`unregister` 404s on the |
| 388 | /// missing event). |
| 389 | /// * **Below teacher** gives up course staffing and homeroom-teacher |
| 390 | /// columns — only teacher+ may hold either — and the published |
| 391 | /// appointment calendar, whose live bookings are cancelled in the same |
| 392 | /// breath. Nothing else could ever reach those: a slot is listed only on |
| 393 | /// its own teacher's calendar and deleted only by a teacher+, so after the |
| 394 | /// demotion neither its owner nor a manager has a route that yields its |
| 395 | /// id, and a booking on it can be neither decided (teacher+ only) nor |
| 396 | /// cancelled once its window opens — leaving the slot's `occupied` seat |
| 397 | /// pinned at one and the slot itself undeletable forever. The requester |
| 398 | /// keeps the row, `cancelled`, with the teacher on `cancelled_by` and the |
| 399 | /// reason on `cancel_reason`; the slot it pointed at is gone (the |
| 400 | /// `ON DELETE SET NULL` link carries the delete), so the booking renders |
| 401 | /// without a window |
| 402 | /// ([`crate::domain::appointment::Appointment`]'s reader already treats a |
| 403 | /// vanished slot that way). There is no notification anywhere in |
| 404 | /// this crate, so a settled row the person can read is the strongest |
| 405 | /// defined end available — and the alternative, deleting it, would make a |
| 406 | /// confirmed meeting vanish with no trace at all. |
| 407 | /// |
| 408 | /// The returned boards are the rooms whose roster this changed, plus those |
| 409 | /// the user created — whose roster is untouched but which are now closed, |
| 410 | /// and they carry that stamp because the close is written first. Publishing |
| 411 | /// to them is the caller's job: an in-process |
| 412 | /// fan-out cannot sit inside a database transaction, and a room told before |
| 413 | /// the commit would re-read the pre-commit state. |
| 414 | /// |
| 415 | /// **The admin floor is the role write's own `WHERE`.** The old guard was a |
| 416 | /// count read under a process-wide lock held across the whole cascade, |
| 417 | /// because the old store could not serialize a cross-record count against a |
| 418 | /// concurrent update (write-skew). Here the count rides the very row write |
| 419 | /// it guards — a demotion that would leave no other admin writes zero rows |
| 420 | /// — so two racing demotions contend on row locks and exactly one lands. |
| 421 | /// Zero rows therefore means the floor refused; the missing-row reading of |
| 422 | /// zero rows is unreachable (no route deletes a user row, and the caller's |
| 423 | /// 404 pre-read answers that case first anyway). |
| 424 | pub async |
| 425 | |
| 426 | |
| 427 | |
| 428 | |
| 429 | |
| 430 | |
| 431 | |
| 432 | |
| 433 | |
| 434 | |
| 435 | |
| 436 | |
| 437 | |
| 438 | |
| 439 | |
| 440 | |
| 441 | |
| 442 | |
| 443 | |
| 444 | |
| 445 | |
| 446 | |
| 447 | |
| 448 | |
| 449 | |
| 450 | |
| 451 | |
| 452 | |
| 453 | |
| 454 | |
| 455 | |
| 456 | |
| 457 | |
| 458 | |
| 459 | |
| 460 | |
| 461 | |
| 462 | |
| 463 | |
| 464 | |
| 465 | |
| 466 | |
| 467 | |
| 468 | |
| 469 | |
| 470 | |
| 471 | |
| 472 | |
| 473 | |
| 474 | |
| 475 | |
| 476 | |
| 477 | |
| 478 | |
| 479 | |
| 480 | |
| 481 | |
| 482 | |
| 483 | |
| 484 | |
| 485 | |
| 486 | |
| 487 | |
| 488 | |
| 489 | |
| 490 | |
| 491 | |
| 492 | |
| 493 | |
| 494 | |
| 495 | |
| 496 | |
| 497 | |
| 498 | |
| 499 | |
| 500 | |
| 501 | |
| 502 | |
| 503 | |
| 504 | |
| 505 | |
| 506 | |
| 507 | |
| 508 | |
| 509 | |
| 510 | |
| 511 | |
| 512 | |
| 513 | |
| 514 | |
| 515 | |
| 516 | |
| 517 | |
| 518 | |
| 519 | |
| 520 | |
| 521 | |
| 522 | |
| 523 | |
| 524 | |
| 525 | |
| 526 | |
| 527 | |
| 528 | |
| 529 | |
| 530 | |
| 531 | |
| 532 | |
| 533 | |
| 534 | |
| 535 | |
| 536 | |
| 537 | |
| 538 | |
| 539 | |
| 540 | |
| 541 | |
| 542 | |
| 543 | |
| 544 | |
| 545 | |
| 546 | |
| 547 | |
| 548 | |
| 549 | |
| 550 | |
| 551 | |
| 552 | |
| 553 | |
| 554 | |
| 555 | |
| 556 | |
| 557 | |
| 558 | |
| 559 | |
| 560 | |
| 561 | |
| 562 | |
| 563 | |
| 564 | |
| 565 | |
| 566 | |
| 567 | |
| 568 | |
| 569 | |
| 570 | |
| 571 | |
| 572 | |
| 573 | |
| 574 | |
| 575 | |
| 576 | |
| 577 | |
| 578 | |
| 579 | |
| 580 | |
| 581 | |
| 582 | |
| 583 | |
| 584 | |
| 585 | |
| 586 | |
| 587 | |
| 588 | |
| 589 | |
| 590 | |
| 591 | |
| 592 | |
| 593 | |
| 594 | |
| 595 | |
| 596 | |
| 597 | |
| 598 | |
| 599 | |
| 600 | |
| 601 | |
| 602 | |
| 603 | |
| 604 | |
| 605 | |
| 606 | |
| 607 | |
| 608 | |
| 609 | |
| 610 | |
| 611 | |
| 612 | |
| 613 | |
| 614 | |
| 615 | |
| 616 | |
| 617 | |
| 618 | |
| 619 | |
| 620 | |
| 621 | |
| 622 | |
| 623 | |
| 624 | |
| 625 | |
| 626 | |
| 627 | |
| 628 | |
| 629 | |
| 630 | |
| 631 | |
| 632 | |
| 633 | |
| 634 | |
| 635 | |
| 636 | |
| 637 | |
| 638 | |
| 639 | |
| 640 | |
| 641 | |
| 642 | |
| 643 | |
| 644 | |
| 645 | |
| 646 | |
| 647 | |
| 648 | |
| 649 | |
| 650 | |
| 651 | |
| 652 | |
| 653 | |
| 654 | |
| 655 | |
| 656 | |
| 657 | |
| 658 | |
| 659 | |
| 660 | |
| 661 | |
| 662 | |
| 663 | |
| 664 | |
| 665 | |
| 666 | |
| 667 | |
| 668 | |
| 669 | |
| 670 | |
| 671 | |
| 672 | |
| 673 | |
| 674 | |
| 675 | |
| 676 | |
| 677 | |
| 678 | |
| 679 | |
| 680 | |
| 681 | |
| 682 | |
| 683 | |
| 684 | |
| 685 | |
| 686 | |
| 687 | |
| 688 | |
| 689 | |
| 690 | |
| 691 | |
| 692 | |
| 693 | |
| 694 | |
| 695 | |
| 696 | |
| 697 | |
| 698 | |
| 699 | |
| 700 | |
| 701 | |
| 702 | |
| 703 | |
| 704 | |
| 705 | |
| 706 | |
| 707 | |
| 708 | |
| 709 | |
| 710 | |
| 711 | |
| 712 | |
| 713 | |
| 714 | |
| 715 | |
| 716 | |
| 717 | |
| 718 | |
| 719 | |
| 720 | |
| 721 | |
| 722 | |
| 723 | |
| 724 | |
| 725 | /// Write the personal-info and public-profile fields the request actually |
| 726 | /// carried — everything a person edits about themselves except the avatar |
| 727 | /// blob, which needs its own writer ([`set_avatar`]). Every |
| 728 | /// column is nullable, so each argument is an outer/inner `Option`: `None` |
| 729 | /// = omitted (not written at all), `Some(None)` = cleared, `Some(Some(v))` |
| 730 | /// = set. Merging the request against the current row is the HTTP layer's |
| 731 | /// job; the caller authorizes. |
| 732 | /// |
| 733 | /// Request-scoped, not merely field-scoped: nothing guards the row across |
| 734 | /// the handler's read and this write, so re-sending the snapshot's value |
| 735 | /// for an omitted field would revert a concurrent PATCH of that field — |
| 736 | /// two profile edits (a name and a phone) used to lose each other. See |
| 737 | /// [`set_role_cascade`] for why no writer here touches the whole row. |
| 738 | /// |
| 739 | /// `student_number` is the one column here whose write can be *violated* |
| 740 | /// rather than merely refused: the partial unique index is its whole |
| 741 | /// availability check, so a duplicate the caller did not pre-check (and |
| 742 | /// could not — a pre-check races) comes back as the index's 23505 and is |
| 743 | /// mapped to the same 409 the duplicate-username path answers. The role |
| 744 | /// gate ("only a student holds one") stays at the web layer, which holds |
| 745 | /// the row it read. |
| 746 | // One argument per nullable column is the point: folding them into a struct |
| 747 | // would just re-spell the HTTP DTO here and cost the compiler's check that |
| 748 | // every column was considered at the call site. |
| 749 | |
| 750 | pub async |
| 751 | |
| 752 | |
| 753 | |
| 754 | |
| 755 | |
| 756 | |
| 757 | |
| 758 | |
| 759 | |
| 760 | |
| 761 | |
| 762 | |
| 763 | |
| 764 | |
| 765 | |
| 766 | |
| 767 | |
| 768 | |
| 769 | |
| 770 | |
| 771 | |
| 772 | |
| 773 | |
| 774 | |
| 775 | |
| 776 | |
| 777 | |
| 778 | |
| 779 | |
| 780 | |
| 781 | |
| 782 | |
| 783 | |
| 784 | |
| 785 | |
| 786 | |
| 787 | |
| 788 | |
| 789 | |
| 790 | |
| 791 | |
| 792 | |
| 793 | |
| 794 | |
| 795 | |
| 796 | |
| 797 | |
| 798 | |
| 799 | |
| 800 | |
| 801 | |
| 802 | |
| 803 | |
| 804 | |
| 805 | |
| 806 | |
| 807 | |
| 808 | |
| 809 | |
| 810 | |
| 811 | |
| 812 | |
| 813 | |
| 814 | |
| 815 | |
| 816 | |
| 817 | |
| 818 | |
| 819 | |
| 820 | |
| 821 | |
| 822 | |
| 823 | |
| 824 | |
| 825 | |
| 826 | |
| 827 | |
| 828 | |
| 829 | |
| 830 | |
| 831 | |
| 832 | |
| 833 | |
| 834 | |
| 835 | |
| 836 | |
| 837 | |
| 838 | |
| 839 | |
| 840 | |
| 841 | |
| 842 | |
| 843 | |
| 844 | |
| 845 | |
| 846 | |
| 847 | |
| 848 | |
| 849 | |
| 850 | |
| 851 | |
| 852 | |
| 853 | |
| 854 | |
| 855 | |
| 856 | |
| 857 | |
| 858 | |
| 859 | |
| 860 | |
| 861 | |
| 862 | |
| 863 | |
| 864 | |
| 865 | |
| 866 | |
| 867 | |
| 868 | |
| 869 | |
| 870 | /// Point the row at a freshly uploaded avatar blob, returning the row *as |
| 871 | /// it was* — the caller deletes `before.get_avatar_file()` off disk. Losing |
| 872 | /// the pre-image here strands the replaced blob forever: no route ever |
| 873 | /// deletes a user, so nothing else would collect it. |
| 874 | /// |
| 875 | /// Field-scoped for the same reason as [`set_profile`]: an avatar |
| 876 | /// upload must not carry a stale snapshot's role back over an admin's |
| 877 | /// change. `None` means the row is gone. |
| 878 | /// |
| 879 | /// The row is locked across the pre-image read and the write (`FOR |
| 880 | /// UPDATE`), so two racing uploads each collect the blob *they* actually |
| 881 | /// replaced — the read and the write are one unit, not a guess that stayed |
| 882 | /// true. |
| 883 | pub async |
| 884 | |
| 885 | |
| 886 | |
| 887 | |
| 888 | |
| 889 | |
| 890 | |
| 891 | |
| 892 | |
| 893 | |
| 894 | |
| 895 | |
| 896 | |
| 897 | |
| 898 | |
| 899 | |
| 900 | |
| 901 | |
| 902 | |
| 903 | |
| 904 | |
| 905 | |
| 906 | |
| 907 | |
| 908 | |
| 909 | |
| 910 | |
| 911 | |
| 912 | |
| 913 | |
| 914 | |
| 915 | |
| 916 | |
| 917 | |
| 918 | |
| 919 | |
| 920 | |
| 921 | |
| 922 | |
| 923 | |
| 924 | |
| 925 | |
| 926 | |
| 927 | |
| 928 | |
| 929 | |
| 930 | |
| 931 | |
| 932 | |
| 933 | |
| 934 | |
| 935 | |
| 936 | |
| 937 | |
| 938 | |
| 939 | |
| 940 | |
| 941 | |
| 942 | |
| 943 | |
| 944 | /// Drop the avatar, returning the row as it was so the caller can delete |
| 945 | /// the blob. Same pre-image contract as [`set_avatar`]. |
| 946 | pub async |
| 947 | |
| 948 | |
| 949 | |
| 950 | |
| 951 | |
| 952 | |
| 953 | |
| 954 | |
| 955 | |
| 956 | |
| 957 | |
| 958 | |
| 959 | |
| 960 | |
| 961 | |
| 962 | |
| 963 | |
| 964 | |
| 965 | |
| 966 | |
| 967 | |
| 968 | |
| 969 | |
| 970 | |
| 971 | |
| 972 | |
| 973 | |
| 974 | |
| 975 | |
| 976 | |
| 977 | |
| 978 | |
| 979 | |
| 980 | |
| 981 | |
| 982 | |
| 983 | |
| 984 | |
| 985 | |
| 986 | |
| 987 | |
| 988 | |
| 989 | |
| 990 | |
| 991 | |
| 992 | |
| 993 | |
| 994 | |
| 995 | /// Write the UI-preference fields the request actually carried. Same |
| 996 | /// contract as [`set_profile`]: `None` = omitted (not written), |
| 997 | /// `Some(None)` = cleared back to "never chose", `Some(Some(v))` = set. |
| 998 | pub async |
| 999 | |
| 1000 | |
| 1001 | |
| 1002 | |
| 1003 | |
| 1004 | |
| 1005 | |
| 1006 | |
| 1007 | |
| 1008 | |
| 1009 | |
| 1010 | |
| 1011 | |
| 1012 | |
| 1013 | |
| 1014 | |
| 1015 | |
| 1016 | pub async |
| 1017 | |
| 1018 | |
| 1019 | |
| 1020 | |
| 1021 | |
| 1022 | |
| 1023 | |
| 1024 | |
| 1025 | |
| 1026 | |
| 1027 | |
| 1028 | |
| 1029 | |
| 1030 | |
| 1031 | |
| 1032 | |
| 1033 | |
| 1034 | |
| 1035 | |
| 1036 | |
| 1037 | |
| 1038 | |
| 1039 | |
| 1040 | |
| 1041 | |
| 1042 | |
| 1043 | |
| 1044 | |
| 1045 | |
| 1046 | |
| 1047 | |
| 1048 | |
| 1049 | |
| 1050 | |
| 1051 | |
| 1052 | |
| 1053 | |
| 1054 | |
| 1055 | |
| 1056 | |
| 1057 | |
| 1058 | |
| 1059 | |
| 1060 | |
| 1061 | |
| 1062 | |
| 1063 | |
| 1064 | |
| 1065 | |
| 1066 | |
| 1067 | |
| 1068 | |
| 1069 | |
| 1070 | |
| 1071 | |
| 1072 | |
| 1073 | |
| 1074 | |
| 1075 | |
| 1076 | |
| 1077 | |
| 1078 | |
| 1079 | |
| 1080 | |
| 1081 | |
| 1082 | |
| 1083 | |
| 1084 | |
| 1085 | |
| 1086 | |
| 1087 | |
| 1088 | |
| 1089 | |
| 1090 | |
| 1091 | |
| 1092 | |
| 1093 | |
| 1094 | |
| 1095 | |
| 1096 | |
| 1097 | |
| 1098 | |
| 1099 | |
| 1100 | |
| 1101 | |
| 1102 | |
| 1103 | |
| 1104 | |
| 1105 | |
| 1106 | |
| 1107 | |
| 1108 | |
| 1109 | |
| 1110 | |
| 1111 | |
| 1112 | |
| 1113 | |
| 1114 | |
| 1115 | |
| 1116 | |
| 1117 | |
| 1118 | |
| 1119 | |
| 1120 | |
| 1121 | |
| 1122 | |
| 1123 | |
| 1124 | |
| 1125 | |
| 1126 | |
| 1127 | |
| 1128 | |
| 1129 | |
| 1130 | |
| 1131 | |
| 1132 | |
| 1133 | |
| 1134 | |
| 1135 | |
| 1136 | |
| 1137 | |
| 1138 | |
| 1139 | |
| 1140 | |
| 1141 | |
| 1142 | |
| 1143 | |
| 1144 | |
| 1145 | |
| 1146 | |
| 1147 | |
| 1148 | |
| 1149 | |
| 1150 | |
| 1151 | |
| 1152 | |
| 1153 | |
| 1154 | |
| 1155 | |
| 1156 | |
| 1157 | |
| 1158 | |
| 1159 | |
| 1160 | |
| 1161 | |
| 1162 | |
| 1163 | |
| 1164 | |
| 1165 | |
| 1166 | |
| 1167 | |
| 1168 | |
| 1169 | |
| 1170 | |
| 1171 | |
| 1172 | |
| 1173 | |
| 1174 | |
| 1175 | |
| 1176 | |
| 1177 | |
| 1178 | |
| 1179 | |
| 1180 | |
| 1181 | |
| 1182 | |
| 1183 | |
| 1184 | |
| 1185 | |
| 1186 | |
| 1187 | |
| 1188 | |
| 1189 | |
| 1190 | |
| 1191 | |
| 1192 | |
| 1193 | |
| 1194 | |
| 1195 | |
| 1196 | |
| 1197 | |
| 1198 | |
| 1199 | |
| 1200 | |
| 1201 | |
| 1202 | |
| 1203 | |
| 1204 | |
| 1205 | |
| 1206 | |
| 1207 | |
| 1208 | |
| 1209 | |
| 1210 | |
| 1211 | |
| 1212 | |
| 1213 | |
| 1214 | |
| 1215 | |
| 1216 | |
| 1217 | |
| 1218 | |
| 1219 | |
| 1220 | |
| 1221 | |
| 1222 | |
| 1223 | |
| 1224 | |
| 1225 | |
| 1226 | |
| 1227 | |
| 1228 | |
| 1229 | |
| 1230 | |
| 1231 | |
| 1232 | |
| 1233 | |
| 1234 | |
| 1235 | |
| 1236 | |
| 1237 | |
| 1238 | |
| 1239 | |
| 1240 | |
| 1241 | |
| 1242 | |
| 1243 | |
| 1244 | |
| 1245 | |
| 1246 | |
| 1247 | |
| 1248 | |
| 1249 | |
| 1250 | |
| 1251 | |
| 1252 | |
| 1253 | |
| 1254 | |
| 1255 | |
| 1256 | |
| 1257 | |
| 1258 | |
| 1259 | |
| 1260 | |
| 1261 | |
| 1262 | |
| 1263 | |
| 1264 | |
| 1265 | |
| 1266 | |
| 1267 | |
| 1268 | |
| 1269 | |
| 1270 | |
| 1271 | |
| 1272 | |
| 1273 | |
| 1274 | |
| 1275 | |
| 1276 | |
| 1277 | |
| 1278 | |
| 1279 | |
| 1280 | |
| 1281 | |
| 1282 | |
| 1283 | |
| 1284 | |
| 1285 | |
| 1286 | |
| 1287 | |
| 1288 | |
| 1289 | |
| 1290 | |
| 1291 | |
| 1292 | |
| 1293 | |
| 1294 | |
| 1295 | |
| 1296 | |
| 1297 | |
| 1298 | |
| 1299 | |
| 1300 | |
| 1301 | |
| 1302 | |
| 1303 | |
| 1304 | |
| 1305 | |
| 1306 | |
| 1307 | |
| 1308 | |
| 1309 | |
| 1310 | |
| 1311 | |
| 1312 | |
| 1313 | |
| 1314 | |
| 1315 | |
| 1316 | |
| 1317 | |
| 1318 | |
| 1319 | |
| 1320 | |
| 1321 | |
| 1322 | |
| 1323 | |
| 1324 | |
| 1325 | |
| 1326 | |
| 1327 | |
| 1328 | |
| 1329 | |
| 1330 | |
| 1331 | |
| 1332 | |
| 1333 |