PoC of refactoring actions
This commit is contained in:
parent
6ee741fd5f
commit
e630997ff5
11 changed files with 158 additions and 56 deletions
21
src/models/person.rs
Normal file
21
src/models/person.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
use chrono::NaiveDate;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::types::PersonResponseDto;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Person {
|
||||
pub id: Uuid,
|
||||
pub name: String,
|
||||
pub date_of_birth: Option<NaiveDate>,
|
||||
}
|
||||
|
||||
impl From<PersonResponseDto> for Person {
|
||||
fn from(value: PersonResponseDto) -> Self {
|
||||
Self {
|
||||
id: Uuid::parse_str(&value.id).expect("Unable to parse a person's UUID"),
|
||||
name: value.name,
|
||||
date_of_birth: value.birth_date,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue