changed all types to use u32 instead of i32

This commit is contained in:
Franklin 2023-03-05 08:53:25 -04:00
parent 400f705ead
commit 6ca6a73679
2 changed files with 7 additions and 7 deletions

View File

@ -1,15 +1,15 @@
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use serde::{Serialize, Deserialize}; use serde::{Serialize, Deserialize};
pub const AUTH_TOKEN_EXPIRATION_TIME_IN_DAYS:i32 = 1; pub const AUTH_TOKEN_EXPIRATION_TIME_IN_DAYS:u32 = 1;
pub const REFRESH_TOKEN_EXPIRATION_TIME_IN_DAYS: i32 = 20; pub const REFRESH_TOKEN_EXPIRATION_TIME_IN_DAYS: u32 = 20;
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)] #[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
pub struct Token { pub struct Token {
#[serde(skip_serializing, skip_deserializing)] #[serde(skip_serializing, skip_deserializing)]
pub id: i32, pub id: u32,
#[serde(rename = "userId")] #[serde(rename = "userId")]
pub user_id: i32, pub user_id: u32,
#[serde(skip_serializing, skip_deserializing)] #[serde(skip_serializing, skip_deserializing)]
pub time_created: Option<NaiveDateTime>, pub time_created: Option<NaiveDateTime>,
#[serde(skip_serializing, skip_deserializing)] #[serde(skip_serializing, skip_deserializing)]
@ -21,7 +21,7 @@ pub struct Token {
} }
impl Token{ impl Token{
pub fn new(user_id: i32, auth_token: String, refresh_token: String) -> Token{ pub fn new(user_id: u32, auth_token: String, refresh_token: String) -> Token{
Token { Token {
id: 0, id: 0,
user_id, user_id,

View File

@ -5,7 +5,7 @@ use crate::dtos::user::user_dtos::UserForCreationDto;
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)] #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct User { pub struct User {
pub id: i32, pub id: u32,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub time_created: Option<NaiveDateTime>, pub time_created: Option<NaiveDateTime>,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]