Fix MongoDB DateTime serialization issues - Replace chrono::DateTime with mongodb::bson::DateTime in models - Update API responses to use timestamp_millis() for JSON serialization - Fix User, Share model DateTime fields - Update all handler responses to return i64 timestamps - This fixes the Kind: invalid type: map, expected RFC 3339 error
This commit is contained in:
parent
1e914089d5
commit
3a6bcbd94d
5 changed files with 25 additions and 20 deletions
|
|
@ -2,6 +2,7 @@ use mongodb::bson::{doc, oid::ObjectId};
|
|||
use mongodb::Collection;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use mongodb::bson::DateTime;
|
||||
use crate::auth::password::verify_password;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
|
@ -26,10 +27,10 @@ pub struct User {
|
|||
pub token_version: i32,
|
||||
|
||||
/// When the user was created
|
||||
pub created_at: chrono::DateTime<chrono::Utc>,
|
||||
pub created_at: DateTime,
|
||||
|
||||
/// Last time the user was active
|
||||
pub last_active: chrono::DateTime<chrono::Utc>,
|
||||
pub last_active: DateTime,
|
||||
|
||||
/// Email verification status
|
||||
pub email_verified: bool,
|
||||
|
|
@ -40,7 +41,7 @@ pub struct User {
|
|||
|
||||
/// When the verification token expires
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub verification_expires: Option<chrono::DateTime<chrono::Utc>>,
|
||||
pub verification_expires: Option<DateTime>,
|
||||
}
|
||||
|
||||
impl User {
|
||||
|
|
@ -64,7 +65,7 @@ impl User {
|
|||
None
|
||||
};
|
||||
|
||||
let now = chrono::Utc::now();
|
||||
let now = DateTime::now();
|
||||
let recovery_enabled = recovery_phrase_hash.is_some();
|
||||
|
||||
Ok(User {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue