forge
Explore
Log in

Don't you dare go Hollow

Qualify uuid::Uuid in accessor where the import is absent

Browse files at this commit

3343a14ee497fb0e5a64e8830e97c04593a82de1Ahmet Kaan GümüşParent: b3ab76f
  • fix
    • qualify uuid::Uuid in accessor where the import is absent
Show full message
🗃️ fix: qualify uuid::Uuid in accessor where the import is absent
src/domain/appointment.rsmodified+1 -1
@@ -47,7 +47,7 @@ impl AppointmentId {
47 47
48 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that48 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
49 /// cannot take the newtype. Static `query!` binds take `self` directly.49 /// cannot take the newtype. Static `query!` binds take `self` directly.
50- pub fn uuid(&self) -> Uuid {50+ pub fn uuid(&self) -> uuid::Uuid {
51 self.051 self.0
52 }52 }
53 53
src/domain/appointment_slot.rsmodified+1 -1
@@ -44,7 +44,7 @@ impl AppointmentSlotId {
44 44
45 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that45 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
46 /// cannot take the newtype. Static `query!` binds take `self` directly.46 /// cannot take the newtype. Static `query!` binds take `self` directly.
47- pub fn uuid(&self) -> Uuid {47+ pub fn uuid(&self) -> uuid::Uuid {
48 self.048 self.0
49 }49 }
50 50
src/domain/bank_question.rsmodified+1 -1
@@ -77,7 +77,7 @@ impl BankQuestionId {
77 77
78 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that78 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
79 /// cannot take the newtype. Static `query!` binds take `self` directly.79 /// cannot take the newtype. Static `query!` binds take `self` directly.
80- pub fn uuid(&self) -> Uuid {80+ pub fn uuid(&self) -> uuid::Uuid {
81 self.081 self.0
82 }82 }
83 83
src/domain/board.rsmodified+1 -1
@@ -32,7 +32,7 @@ impl BoardId {
32 32
33 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that33 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
34 /// cannot take the newtype. Static `query!` binds take `self` directly.34 /// cannot take the newtype. Static `query!` binds take `self` directly.
35- pub fn uuid(&self) -> Uuid {35+ pub fn uuid(&self) -> uuid::Uuid {
36 self.036 self.0
37 }37 }
38 38
src/domain/board_stroke.rsmodified+1 -1
@@ -69,7 +69,7 @@ impl BoardStrokeId {
69 69
70 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that70 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
71 /// cannot take the newtype. Static `query!` binds take `self` directly.71 /// cannot take the newtype. Static `query!` binds take `self` directly.
72- pub fn uuid(&self) -> Uuid {72+ pub fn uuid(&self) -> uuid::Uuid {
73 self.073 self.0
74 }74 }
75 75
src/domain/chatbot_message.rsmodified+1 -1
@@ -41,7 +41,7 @@ impl ChatbotMessageId {
41 41
42 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that42 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
43 /// cannot take the newtype. Static `query!` binds take `self` directly.43 /// cannot take the newtype. Static `query!` binds take `self` directly.
44- pub fn uuid(&self) -> Uuid {44+ pub fn uuid(&self) -> uuid::Uuid {
45 self.045 self.0
46 }46 }
47 47
src/domain/chatbot_thread.rsmodified+1 -1
@@ -26,7 +26,7 @@ impl ChatbotThreadId {
26 26
27 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that27 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
28 /// cannot take the newtype. Static `query!` binds take `self` directly.28 /// cannot take the newtype. Static `query!` binds take `self` directly.
29- pub fn uuid(&self) -> Uuid {29+ pub fn uuid(&self) -> uuid::Uuid {
30 self.030 self.0
31 }31 }
32 32
src/domain/class_group.rsmodified+1 -1
@@ -32,7 +32,7 @@ impl ClassGroupId {
32 32
33 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that33 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
34 /// cannot take the newtype. Static `query!` binds take `self` directly.34 /// cannot take the newtype. Static `query!` binds take `self` directly.
35- pub fn uuid(&self) -> Uuid {35+ pub fn uuid(&self) -> uuid::Uuid {
36 self.036 self.0
37 }37 }
38 38
src/domain/course.rsmodified+1 -1
@@ -20,7 +20,7 @@ impl CourseId {
20 20
21 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that21 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
22 /// cannot take the newtype. Static `query!` binds take `self` directly.22 /// cannot take the newtype. Static `query!` binds take `self` directly.
23- pub fn uuid(&self) -> Uuid {23+ pub fn uuid(&self) -> uuid::Uuid {
24 self.024 self.0
25 }25 }
26 26
src/domain/course_note.rsmodified+1 -1
@@ -20,7 +20,7 @@ impl CourseNoteId {
20 20
21 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that21 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
22 /// cannot take the newtype. Static `query!` binds take `self` directly.22 /// cannot take the newtype. Static `query!` binds take `self` directly.
23- pub fn uuid(&self) -> Uuid {23+ pub fn uuid(&self) -> uuid::Uuid {
24 self.024 self.0
25 }25 }
26 26
src/domain/course_note_file.rsmodified+1 -1
@@ -28,7 +28,7 @@ impl CourseNoteFileId {
28 28
29 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that29 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
30 /// cannot take the newtype. Static `query!` binds take `self` directly.30 /// cannot take the newtype. Static `query!` binds take `self` directly.
31- pub fn uuid(&self) -> Uuid {31+ pub fn uuid(&self) -> uuid::Uuid {
32 self.032 self.0
33 }33 }
34 34
src/domain/course_session.rsmodified+1 -1
@@ -21,7 +21,7 @@ impl CourseSessionId {
21 21
22 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that22 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
23 /// cannot take the newtype. Static `query!` binds take `self` directly.23 /// cannot take the newtype. Static `query!` binds take `self` directly.
24- pub fn uuid(&self) -> Uuid {24+ pub fn uuid(&self) -> uuid::Uuid {
25 self.025 self.0
26 }26 }
27 27
src/domain/event.rsmodified+27 -1
@@ -23,7 +23,7 @@ impl EventId {
23 23
24 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that24 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
25 /// cannot take the newtype. Static `query!` binds take `self` directly.25 /// cannot take the newtype. Static `query!` binds take `self` directly.
26- pub fn uuid(&self) -> Uuid {26+ pub fn uuid(&self) -> uuid::Uuid {
27 self.027 self.0
28 }28 }
29 29
@@ -132,6 +132,32 @@ impl EventAudienceKind {
132 match self {132 match self {
133 EventAudienceKind::School => "school",133 EventAudienceKind::School => "school",
134 EventAudienceKind::Role => "role",134 EventAudienceKind::Role => "role",
135+
136+/// The five audience columns as one value — the write-side bundle. The row
137+/// keeps them flat; every write spells them as a unit, so a kind and its
138+/// payload always land together and only the payload matching `kind` is
139+/// ever non-NULL.
140+#[derive(Debug, Clone, PartialEq, Eq)]
141+pub struct EventAudience {
142+ pub kind: EventAudienceKind,
143+ pub role: Option<Role>,
144+ pub course: Option<CourseId>,
145+ pub class: Option<ClassGroupId>,
146+ pub capacity: Option<i64>,
147+}
148+
149+impl EventAudience {
150+ /// The audience of a row read back from the store.
151+ pub fn of_row(event: &Event) -> Self {
152+ Self {
153+ kind: event.get_audience_kind(),
154+ role: event.get_audience_role(),
155+ course: event.get_audience_course().copied(),
156+ class: event.get_audience_class().copied(),
157+ capacity: event.get_audience_capacity(),
158+ }
159+ }
160+}
135 EventAudienceKind::Course => "course",161 EventAudienceKind::Course => "course",
136 EventAudienceKind::Class => "class",162 EventAudienceKind::Class => "class",
137 EventAudienceKind::Registration => "registration",163 EventAudienceKind::Registration => "registration",
src/domain/exam.rsmodified+1 -1
@@ -37,7 +37,7 @@ impl ExamId {
37 37
38 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that38 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
39 /// cannot take the newtype. Static `query!` binds take `self` directly.39 /// cannot take the newtype. Static `query!` binds take `self` directly.
40- pub fn uuid(&self) -> Uuid {40+ pub fn uuid(&self) -> uuid::Uuid {
41 self.041 self.0
42 }42 }
43 43
src/domain/exam_question.rsmodified+1 -1
@@ -27,7 +27,7 @@ impl ExamQuestionId {
27 27
28 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that28 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
29 /// cannot take the newtype. Static `query!` binds take `self` directly.29 /// cannot take the newtype. Static `query!` binds take `self` directly.
30- pub fn uuid(&self) -> Uuid {30+ pub fn uuid(&self) -> uuid::Uuid {
31 self.031 self.0
32 }32 }
33 33
src/domain/fee_plan.rsmodified+1 -1
@@ -34,7 +34,7 @@ impl FeePlanId {
34 34
35 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that35 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
36 /// cannot take the newtype. Static `query!` binds take `self` directly.36 /// cannot take the newtype. Static `query!` binds take `self` directly.
37- pub fn uuid(&self) -> Uuid {37+ pub fn uuid(&self) -> uuid::Uuid {
38 self.038 self.0
39 }39 }
40 40
src/domain/homework.rsmodified+1 -1
@@ -36,7 +36,7 @@ impl HomeworkId {
36 36
37 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that37 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
38 /// cannot take the newtype. Static `query!` binds take `self` directly.38 /// cannot take the newtype. Static `query!` binds take `self` directly.
39- pub fn uuid(&self) -> Uuid {39+ pub fn uuid(&self) -> uuid::Uuid {
40 self.040 self.0
41 }41 }
42 42
src/domain/homework_file.rsmodified+1 -1
@@ -29,7 +29,7 @@ impl HomeworkFileId {
29 29
30 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that30 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
31 /// cannot take the newtype. Static `query!` binds take `self` directly.31 /// cannot take the newtype. Static `query!` binds take `self` directly.
32- pub fn uuid(&self) -> Uuid {32+ pub fn uuid(&self) -> uuid::Uuid {
33 self.033 self.0
34 }34 }
35 35
src/domain/homework_result.rsmodified+1 -1
@@ -34,7 +34,7 @@ impl HomeworkResultId {
34 34
35 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that35 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
36 /// cannot take the newtype. Static `query!` binds take `self` directly.36 /// cannot take the newtype. Static `query!` binds take `self` directly.
37- pub fn uuid(&self) -> Uuid {37+ pub fn uuid(&self) -> uuid::Uuid {
38 self.038 self.0
39 }39 }
40 40
src/domain/homework_submission.rsmodified+1 -1
@@ -34,7 +34,7 @@ impl HomeworkSubmissionId {
34 34
35 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that35 /// The inner uuid, for runtime-checked binds (Param/QueryBuilder) that
36 /// cannot take the newtype. Static `query!` binds take `self` directly.36 /// cannot take the newtype. Static `query!` binds take `self` directly.
37- pub fn uuid(&self) -> Uuid {37+ pub fn uuid(&self) -> uuid::Uuid {
38 self.038 self.0
39 }39 }
40 40
src/domain/work_entry.rsmodified+11 -0
@@ -3,6 +3,7 @@ use uuid::Uuid;
3 use crate::domain::monotonic_id::next_uuid;3 use crate::domain::monotonic_id::next_uuid;
4 use crate::domain::timestamp::Timestamp;4 use crate::domain::timestamp::Timestamp;
5 use crate::domain::user::UserId;5 use crate::domain::user::UserId;
6+use crate::error::{AppError, ValidationError};
6 7
7 /// Typed work-entry row id. A UUIDv7 minted by the process-wide monotonic8 /// Typed work-entry row id. A UUIDv7 minted by the process-wide monotonic
8 /// generator, so `id` order is mint order.9 /// generator, so `id` order is mint order.
@@ -77,3 +78,13 @@ impl WorkEntry {
77 self.check_out.is_none()78 self.check_out.is_none()
78 }79 }
79 }80 }
81+
82+/// The one ordering refusal both the web handler's pre-flight and the db
83+/// layer's write-time guard owe for a corrected stint: the correction must
84+/// still order as *stored* — check-out at or after check-in.
85+pub(crate) fn out_before_in_error() -> AppError {
86+ AppError::Validation(ValidationError::Invalid {
87+ field: "check_out",
88+ reason: "must be at or after check_in",
89+ })
90+}