-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
I'm noticing that the models come with constructors like this:
hexarch/src/lib/domain/blog/models/author.rs
Lines 14 to 17 in d58a5c6
| impl Author { | |
| pub fn new(id: uuid::Uuid, name: AuthorName, email: EmailAddress) -> Self { | |
| Self { id, name, email } | |
| } |
Which is later used by the db implementation:
hexarch/src/lib/outbound/sqlite.rs
Lines 72 to 76 in d58a5c6
| Ok(Author::new( | |
| author_id, | |
| req.name().clone(), | |
| req.email().clone(), | |
| )) |
But this means that consumers can construct potentially invalid Authors that aren't necessarily backed by the db.
Not sure if there's a good solution here, since you need to allow foreign modules to construct Author with the repository trait.
Metadata
Metadata
Assignees
Labels
No labels