Drop lane-local uuid accessors (canonical on postgres)
Browse files at this commitdd0e1d86c12015056841cbb4b1002c85000f2c72Parent: 610b3b5- chore
- drop lane-local uuid accessors (canonical on postgres)
4 changed files +0 -40
- src/domain/course.rs +0 -10
- src/domain/course_session.rs +0 -10
- src/domain/subject.rs +0 -10
- src/domain/term.rs +0 -10
src/domain/course.rsmodified+0 -10
| @@ -34,17 +34,7 @@ impl CourseId { | |||
| 34 | self.0.to_string() | 34 | self.0.to_string() |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | - /// The inner uuid, for binding the id through the runtime-checked | ||
| 38 | - /// builders ([`crate::db::page::Param`]) whose values are raw uuids. | ||
| 39 | - pub(crate) fn uuid(&self) -> uuid::Uuid { | ||
| 40 | - self.0 | ||
| 41 | - } | ||
| 42 | } | 37 | } |
| 43 | - | ||
| 44 | -#[derive(Debug, Clone, PartialEq, Eq, sqlx::Type)] | ||
| 45 | -#[sqlx(transparent)] | ||
| 46 | -pub struct CourseTitle(String); | ||
| 47 | - | ||
| 48 | impl CourseTitle { | 38 | impl CourseTitle { |
| 49 | pub fn try_new(value: &str) -> Result<Self, ValidationError> { | 39 | pub fn try_new(value: &str) -> Result<Self, ValidationError> { |
| 50 | validate_required("title", value, MAX_COURSE_TITLE_LEN)?; | 40 | validate_required("title", value, MAX_COURSE_TITLE_LEN)?; |
src/domain/course_session.rsmodified+0 -10
| @@ -35,17 +35,7 @@ impl CourseSessionId { | |||
| 35 | self.0.to_string() | 35 | self.0.to_string() |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | - /// The inner uuid, for binding the id through the runtime-checked | ||
| 39 | - /// builders ([`crate::db::page::Param`]) whose values are raw uuids. | ||
| 40 | - pub(crate) fn uuid(&self) -> uuid::Uuid { | ||
| 41 | - self.0 | ||
| 42 | - } | ||
| 43 | } | 38 | } |
| 44 | - | ||
| 45 | -#[derive(Debug, Clone, PartialEq, Eq, sqlx::Type)] | ||
| 46 | -#[sqlx(transparent)] | ||
| 47 | -pub struct SessionTopic(String); | ||
| 48 | - | ||
| 49 | impl SessionTopic { | 39 | impl SessionTopic { |
| 50 | pub fn try_new(value: &str) -> Result<Self, ValidationError> { | 40 | pub fn try_new(value: &str) -> Result<Self, ValidationError> { |
| 51 | validate_optional("topic", value, MAX_SESSION_TOPIC_LEN)?; | 41 | validate_optional("topic", value, MAX_SESSION_TOPIC_LEN)?; |
src/domain/subject.rsmodified+0 -10
| @@ -41,17 +41,7 @@ impl SubjectId { | |||
| 41 | self.0.to_string() | 41 | self.0.to_string() |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | - /// The inner uuid, for binding the id through the runtime-checked | ||
| 45 | - /// builders ([`crate::db::page::Param`]) whose values are raw uuids. | ||
| 46 | - pub(crate) fn uuid(&self) -> Uuid { | ||
| 47 | - self.0 | ||
| 48 | - } | ||
| 49 | } | 44 | } |
| 50 | - | ||
| 51 | -#[derive(Debug, Clone, PartialEq, Eq, Type)] | ||
| 52 | -#[sqlx(transparent)] | ||
| 53 | -pub struct SubjectName(String); | ||
| 54 | - | ||
| 55 | impl SubjectName { | 45 | impl SubjectName { |
| 56 | pub fn try_new(value: &str) -> Result<Self, ValidationError> { | 46 | pub fn try_new(value: &str) -> Result<Self, ValidationError> { |
| 57 | validate_required("name", value, MAX_SUBJECT_NAME_LEN)?; | 47 | validate_required("name", value, MAX_SUBJECT_NAME_LEN)?; |
src/domain/term.rsmodified+0 -10
| @@ -41,17 +41,7 @@ impl TermId { | |||
| 41 | self.0.to_string() | 41 | self.0.to_string() |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | - /// The inner uuid, for binding the id through the runtime-checked | ||
| 45 | - /// builders ([`crate::db::page::Param`]) whose values are raw uuids. | ||
| 46 | - pub(crate) fn uuid(&self) -> Uuid { | ||
| 47 | - self.0 | ||
| 48 | - } | ||
| 49 | } | 44 | } |
| 50 | - | ||
| 51 | -/// The answer every link to a term that is not there gets — the claim is a | ||
| 52 | -/// conditional write on the term row, so a term a delete already removed | ||
| 53 | -/// matches nothing and the caller says exactly what the link resolver's | ||
| 54 | -/// pre-flight lookup ([`crate::service::term::resolve`]) would have. | ||
| 55 | pub fn gone_error() -> AppError { | 45 | pub fn gone_error() -> AppError { |
| 56 | AppError::Validation(ValidationError::Invalid { | 46 | AppError::Validation(ValidationError::Invalid { |
| 57 | field: "term_id", | 47 | field: "term_id", |