Changed naivedate for date

This commit is contained in:
Franklin 2023-10-10 17:40:38 -04:00
parent 6d355edb1a
commit 737ab8cce0
2 changed files with 7 additions and 7 deletions

View File

@ -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<Utc>,
pub last_updated: DateTime<Utc>,
pub name: String,
pub birth_date: NaiveDate,
pub birth_date: DateTime<Utc>,
pub country: String,
pub city: String,
pub identification_number: Option<String>,
@ -22,13 +22,13 @@ pub struct Player {
impl From<PlayerForCreationDto> 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;

View File

@ -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<Utc>,
pub country: String,
pub city: String,
}
@ -18,7 +18,7 @@ pub struct PlayerForCreationDto {
pub struct PlayerForUpdateDto {
pub name: Option<String>,
#[serde(rename = "birthDate")]
pub birth_date: Option<NaiveDate>,
pub birth_date: Option<DateTime<Utc>>,
pub country: Option<String>,
pub city: Option<String>,
#[serde(rename = "identificationNumber")]