diff --git a/src/domain/appointment.rs b/src/domain/appointment.rs index 9301baf..287743a 100644 --- a/src/domain/appointment.rs +++ b/src/domain/appointment.rs @@ -45,6 +45,12 @@ impl AppointmentId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row — a malformed path param stays a 404, exactly /// like a well-formed one that names nothing. @@ -113,7 +119,12 @@ impl AppointmentReason { #[derive(Debug, Clone, sqlx::FromRow)] pub struct Appointment { pub(crate) id: AppointmentId, - pub(crate) slot: AppointmentSlotId, + /// The booked slot. `NULL` only on a settled row whose slot was later + /// withdrawn (a demotion sweep or a delete after the seat came back): + /// the booking still renders, without a window — the dangling reference + /// the old store permitted, now an explicit NULL. A live booking's slot + /// is pinned by the `occupied` counter and can never be NULL. + pub(crate) slot: Option, pub(crate) requester: UserId, pub(crate) status: AppointmentStatus, pub(crate) reason: AppointmentReason, @@ -137,8 +148,8 @@ impl Appointment { &self.id } - pub fn get_slot(&self) -> &AppointmentSlotId { - &self.slot + pub fn get_slot(&self) -> Option<&AppointmentSlotId> { + self.slot.as_ref() } pub fn get_requester(&self) -> &UserId { diff --git a/src/domain/appointment_slot.rs b/src/domain/appointment_slot.rs index c220293..c05c758 100644 --- a/src/domain/appointment_slot.rs +++ b/src/domain/appointment_slot.rs @@ -42,6 +42,12 @@ impl AppointmentSlotId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row — a malformed path param stays a 404, exactly /// like a well-formed one that names nothing. diff --git a/src/domain/bank_question.rs b/src/domain/bank_question.rs index 98c1821..8d7c7f9 100644 --- a/src/domain/bank_question.rs +++ b/src/domain/bank_question.rs @@ -75,6 +75,12 @@ impl BankQuestionId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row — a malformed path param stays a 404, exactly /// like a well-formed one that names nothing. diff --git a/src/domain/board.rs b/src/domain/board.rs index 671deaf..7b39965 100644 --- a/src/domain/board.rs +++ b/src/domain/board.rs @@ -30,6 +30,12 @@ impl BoardId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row — a malformed path param stays a 404, exactly /// like a well-formed one that names nothing. diff --git a/src/domain/board_stroke.rs b/src/domain/board_stroke.rs index f94186f..1ea4b77 100644 --- a/src/domain/board_stroke.rs +++ b/src/domain/board_stroke.rs @@ -67,6 +67,12 @@ impl BoardStrokeId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/builder.rs b/src/domain/builder.rs index 4c6b94a..bd8d04f 100644 --- a/src/domain/builder.rs +++ b/src/domain/builder.rs @@ -30,6 +30,12 @@ impl BuilderId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/chatbot_message.rs b/src/domain/chatbot_message.rs index df74005..afc6c4d 100644 --- a/src/domain/chatbot_message.rs +++ b/src/domain/chatbot_message.rs @@ -39,6 +39,12 @@ impl ChatbotMessageId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/chatbot_thread.rs b/src/domain/chatbot_thread.rs index c58756c..7bfabac 100644 --- a/src/domain/chatbot_thread.rs +++ b/src/domain/chatbot_thread.rs @@ -24,6 +24,12 @@ impl ChatbotThreadId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/class_group.rs b/src/domain/class_group.rs index 1adbe11..12cc779 100644 --- a/src/domain/class_group.rs +++ b/src/domain/class_group.rs @@ -30,6 +30,12 @@ impl ClassGroupId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/class_member.rs b/src/domain/class_member.rs index fcb623a..9e14e82 100644 --- a/src/domain/class_member.rs +++ b/src/domain/class_member.rs @@ -39,6 +39,9 @@ impl ClassMemberId { #[derive(Debug, Clone, sqlx::FromRow)] pub struct ClassMember { pub(crate) class: ClassGroupId, + /// The column is `app_user` (the reserved-word rename); the Rust name is + /// the domain's. + #[sqlx(rename = "app_user")] pub(crate) user: UserId, pub(crate) added_by: UserId, /// When they were added, and the *only* thing "newest first" can mean diff --git a/src/domain/course.rs b/src/domain/course.rs index d74fbc9..71a2e08 100644 --- a/src/domain/course.rs +++ b/src/domain/course.rs @@ -18,6 +18,12 @@ impl CourseId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/course_note.rs b/src/domain/course_note.rs index d14fa68..4058db2 100644 --- a/src/domain/course_note.rs +++ b/src/domain/course_note.rs @@ -18,6 +18,12 @@ impl CourseNoteId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/course_note_file.rs b/src/domain/course_note_file.rs index 4366aca..5a1d954 100644 --- a/src/domain/course_note_file.rs +++ b/src/domain/course_note_file.rs @@ -26,6 +26,12 @@ impl CourseNoteFileId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/course_session.rs b/src/domain/course_session.rs index f444033..56df9ff 100644 --- a/src/domain/course_session.rs +++ b/src/domain/course_session.rs @@ -19,6 +19,12 @@ impl CourseSessionId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/event.rs b/src/domain/event.rs index 74a508d..07868bb 100644 --- a/src/domain/event.rs +++ b/src/domain/event.rs @@ -21,6 +21,12 @@ impl EventId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/exam.rs b/src/domain/exam.rs index 3fbaca6..c8a256a 100644 --- a/src/domain/exam.rs +++ b/src/domain/exam.rs @@ -35,6 +35,12 @@ impl ExamId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/exam_question.rs b/src/domain/exam_question.rs index 4b624ef..9ba0d10 100644 --- a/src/domain/exam_question.rs +++ b/src/domain/exam_question.rs @@ -25,6 +25,12 @@ impl ExamQuestionId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/fee_plan.rs b/src/domain/fee_plan.rs index c18c073..8c2cb41 100644 --- a/src/domain/fee_plan.rs +++ b/src/domain/fee_plan.rs @@ -32,6 +32,12 @@ impl FeePlanId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/homework.rs b/src/domain/homework.rs index 4d47d5d..7557118 100644 --- a/src/domain/homework.rs +++ b/src/domain/homework.rs @@ -34,6 +34,12 @@ impl HomeworkId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/homework_file.rs b/src/domain/homework_file.rs index c3d9a53..6a83a36 100644 --- a/src/domain/homework_file.rs +++ b/src/domain/homework_file.rs @@ -27,6 +27,12 @@ impl HomeworkFileId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/homework_result.rs b/src/domain/homework_result.rs index 10ac02f..56ee74a 100644 --- a/src/domain/homework_result.rs +++ b/src/domain/homework_result.rs @@ -32,6 +32,12 @@ impl HomeworkResultId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/homework_submission.rs b/src/domain/homework_submission.rs index 9b6773d..143cca9 100644 --- a/src/domain/homework_submission.rs +++ b/src/domain/homework_submission.rs @@ -32,6 +32,12 @@ impl HomeworkSubmissionId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parses a wire key. A key that is not a UUID parses as the nil UUID, /// which matches no row. pub fn from_key(key: &str) -> Self { diff --git a/src/domain/menu_dish.rs b/src/domain/menu_dish.rs index f4993d3..224c137 100644 --- a/src/domain/menu_dish.rs +++ b/src/domain/menu_dish.rs @@ -34,6 +34,12 @@ impl MenuDishId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parse a wire key. A key that parses as no UUID — a malformed path /// segment — reads as the nil id, which matches no row: exactly the 404 a /// dangling record key produced under the old store, without turning a diff --git a/src/domain/message.rs b/src/domain/message.rs index 090336f..7c181bf 100644 --- a/src/domain/message.rs +++ b/src/domain/message.rs @@ -104,6 +104,12 @@ impl MessageId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parse a wire key. A key that parses as no UUID — a malformed path /// segment — reads as the nil id, which matches no row: exactly the 404 a /// dangling record key produced under the old store, without turning a diff --git a/src/domain/note.rs b/src/domain/note.rs index f2c5e05..07978a0 100644 --- a/src/domain/note.rs +++ b/src/domain/note.rs @@ -20,6 +20,12 @@ impl NoteId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parse a wire key. A key that parses as no UUID — a malformed path /// segment — reads as the nil id, which matches no row: exactly the 404 a /// dangling record key produced under the old store, without turning a diff --git a/src/domain/note_file.rs b/src/domain/note_file.rs index 5497e36..0ff0865 100644 --- a/src/domain/note_file.rs +++ b/src/domain/note_file.rs @@ -27,6 +27,12 @@ impl NoteFileId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parse a wire key. A key that parses as no UUID — a malformed path /// segment — reads as the nil id, which matches no row: exactly the 404 a /// dangling record key produced under the old store, without turning a diff --git a/src/domain/pomodoro.rs b/src/domain/pomodoro.rs index 24e0e33..3467b1a 100644 --- a/src/domain/pomodoro.rs +++ b/src/domain/pomodoro.rs @@ -18,6 +18,12 @@ impl PomodoroSessionId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parse a wire key. A key that parses as no UUID — a malformed path /// segment — reads as the nil id, which matches no row: exactly the 404 a /// dangling record key produced under the old store, without turning a diff --git a/src/domain/pool_question.rs b/src/domain/pool_question.rs index 7261d49..48757b5 100644 --- a/src/domain/pool_question.rs +++ b/src/domain/pool_question.rs @@ -38,6 +38,12 @@ impl PoolQuestionId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parse a wire key. A key that parses as no UUID — a malformed path /// segment — reads as the nil id, which matches no row: exactly the 404 a /// dangling record key produced under the old store, without turning a diff --git a/src/domain/rag_output.rs b/src/domain/rag_output.rs index f99e25a..a85b873 100644 --- a/src/domain/rag_output.rs +++ b/src/domain/rag_output.rs @@ -37,6 +37,12 @@ impl RagOutputId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parse a wire key. A key that parses as no UUID — a malformed path /// segment — reads as the nil id, which matches no row: exactly the 404 a /// dangling record key produced under the old store, without turning a diff --git a/src/domain/session.rs b/src/domain/session.rs index fe37ad2..fc2ed4a 100644 --- a/src/domain/session.rs +++ b/src/domain/session.rs @@ -17,6 +17,12 @@ impl SessionId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// The hyphenated wire form. #[allow(dead_code)] pub fn key(&self) -> String { diff --git a/src/domain/solution.rs b/src/domain/solution.rs index 56ae2e2..2c559d0 100644 --- a/src/domain/solution.rs +++ b/src/domain/solution.rs @@ -24,6 +24,12 @@ impl SolutionId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parse a wire key. A key that parses as no UUID — a malformed path /// segment — reads as the nil id, which matches no row: exactly the 404 a /// dangling record key produced under the old store, without turning a diff --git a/src/domain/subject.rs b/src/domain/subject.rs index 59180a8..5b553f3 100644 --- a/src/domain/subject.rs +++ b/src/domain/subject.rs @@ -22,6 +22,12 @@ impl SubjectId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parse a wire key. A key that parses as no UUID — a malformed path /// segment — reads as the nil id, which matches no row: exactly the 404 a /// dangling record key produced under the old store, without turning a diff --git a/src/domain/term.rs b/src/domain/term.rs index bf5a42f..dbd259b 100644 --- a/src/domain/term.rs +++ b/src/domain/term.rs @@ -22,6 +22,12 @@ impl TermId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parse a wire key. A key that parses as no UUID — a malformed path /// segment — reads as the nil id, which matches no row: exactly the 404 a /// dangling record key produced under the old store, without turning a diff --git a/src/domain/user.rs b/src/domain/user.rs index fa06ee1..28934fb 100644 --- a/src/domain/user.rs +++ b/src/domain/user.rs @@ -35,6 +35,12 @@ impl UserId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parse a wire key. A key that parses as no UUID — a malformed path /// segment — reads as the nil id, which matches no row: exactly the 404 a /// dangling record key produced under the old store, without turning a diff --git a/src/domain/work_entry.rs b/src/domain/work_entry.rs index e390eb6..d3385b6 100644 --- a/src/domain/work_entry.rs +++ b/src/domain/work_entry.rs @@ -18,6 +18,12 @@ impl WorkEntryId { Self(next_uuid()) } + /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that + /// cannot take the newtype. Static `query!` binds take `self` directly. + pub fn uuid(&self) -> Uuid { + self.0 + } + /// Parse a wire key. A key that parses as no UUID — a malformed path /// segment — reads as the nil id, which matches no row: exactly the 404 a /// dangling record key produced under the old store, without turning a