From 737ab8cce0cfa324938e2735178b9ec49ed01a82 Mon Sep 17 00:00:00 2001 From: Franklin Date: Tue, 10 Oct 2023 17:40:38 -0400 Subject: [PATCH] Changed naivedate for date --- src/domain/player.rs | 8 ++++---- src/dto/player.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/domain/player.rs b/src/domain/player.rs index e2214df..8c81287 100644 --- a/src/domain/player.rs +++ b/src/domain/player.rs @@ -1,4 +1,4 @@ -use chrono::{Utc, DateTime, NaiveDate,}; +use chrono::{Utc, DateTime}; use serde::{Serialize, Deserialize}; use crate::dto::player::PlayerForCreationDto; @@ -10,7 +10,7 @@ pub struct Player { pub time_created: DateTime, pub last_updated: DateTime, pub name: String, - pub birth_date: NaiveDate, + pub birth_date: DateTime, pub country: String, pub city: String, pub identification_number: Option, @@ -22,13 +22,13 @@ pub struct Player { impl From for Player { fn from(player_dto: PlayerForCreationDto) -> Self { - Player { id: Default::default(), time_created: Utc::now(), last_updated: Utc::now().with_timezone(&Utc), name: player_dto.name.clone(), birth_date: player_dto.birth_date.clone(), country: player_dto.country.clone(), city: player_dto.city.clone(), identification_number: None, bio: None, profile_picture_url: None, id_verified: false, phone_number_verified: false } + Player { id: Default::default(), time_created: Utc::now(), last_updated: Utc::now(), name: player_dto.name.clone(), birth_date: player_dto.birth_date.clone(), country: player_dto.country.clone(), city: player_dto.city.clone(), identification_number: None, bio: None, profile_picture_url: None, id_verified: false, phone_number_verified: false } } } impl Player{ pub fn clear_all_sensitive_fields(mut self) -> Self { - self.birth_date = NaiveDate::default(); + self.birth_date = DateTime::default(); self.city = "".to_string(); self.id_verified = false; self.identification_number = None; diff --git a/src/dto/player.rs b/src/dto/player.rs index 2f26499..f59b0fa 100644 --- a/src/dto/player.rs +++ b/src/dto/player.rs @@ -1,4 +1,4 @@ -use chrono::NaiveDate; +use chrono::{DateTime, Utc}; use serde::{Serialize, Deserialize}; use crate::domain::player::Player; @@ -10,7 +10,7 @@ pub struct PlayerForCreationDto { pub password: String, pub name: String, #[serde(rename = "birthDate")] - pub birth_date: NaiveDate, + pub birth_date: DateTime, pub country: String, pub city: String, } @@ -18,7 +18,7 @@ pub struct PlayerForCreationDto { pub struct PlayerForUpdateDto { pub name: Option, #[serde(rename = "birthDate")] - pub birth_date: Option, + pub birth_date: Option>, pub country: Option, pub city: Option, #[serde(rename = "identificationNumber")]