PoC of refactoring actions

This commit is contained in:
Marc Plano-Lesay 2024-11-06 11:05:49 +11:00
parent 6ee741fd5f
commit e630997ff5
Signed by: kernald
GPG key ID: 66A41B08CC62A6CF
11 changed files with 158 additions and 56 deletions

21
src/models/person.rs Normal file
View 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,
}
}
}