Link up db types

This commit is contained in:
Joshua Coles 2024-03-02 16:59:04 +00:00
parent 84b4c747f5
commit 0f3c031b7a
2 changed files with 27 additions and 2 deletions

View File

@ -67,6 +67,10 @@ impl Project {
client_id: Set(self.client_id.map(|id| id as i32)),
workspace_id: Set(self.workspace_id as i64),
raw_json: Set(serde_json::to_value(self).unwrap()),
color: Set(self.color.clone()),
server_created_at: Set(chrono::DateTime::parse_from_rfc3339(&self.created_at).unwrap()),
server_updated_at: Set(chrono::DateTime::parse_from_rfc3339(&self.at).unwrap()),
server_deleted_at: Set(self.server_deleted_at.map(|dt| chrono::DateTime::parse_from_rfc3339(&dt).unwrap())),
}
}

View File

@ -61,9 +61,30 @@ pub struct Project {
pub client_id: Option<u64>,
pub name: String,
pub active: bool,
pub color: String,
pub at: String,
pub server_deleted_at: Option<String>,
pub created_at: String,
#[serde(flatten)]
pub rest: HashMap<String, Value>,
// cid: Option<serde_json::Value>,
// wid: i64,
// rate: Option<serde_json::Value>,
// status: String,
// billable: Option<serde_json::Value>,
// currency: Option<serde_json::Value>,
// template: Option<serde_json::Value>,
// fixed_fee: Option<serde_json::Value>,
// recurring: bool,
// is_private: bool,
// start_date: String,
// template_id: Option<serde_json::Value>,
// actual_hours: i64,
// actual_seconds: i64,
// auto_estimates: Option<serde_json::Value>,
// estimated_hours: Option<serde_json::Value>,
// estimated_seconds: Option<serde_json::Value>,
// rate_last_updated: Option<serde_json::Value>,
// recurring_parameters: Option<serde_json::Value>,
}
/// Represents a client in Toggl.