final db models wip

This commit is contained in:
timurgordon
2025-06-03 21:51:21 +03:00
parent abbed9a1a1
commit c3f6b91aa0
13 changed files with 1251 additions and 11 deletions

View File

@@ -8,16 +8,6 @@ pub trait BaseModelDataOps: Sized {
self
}
fn set_base_created_at(mut self, time: i64) -> Self {
self.get_base_data_mut().created_at = time;
self
}
fn set_base_modified_at(mut self, time: i64) -> Self {
self.get_base_data_mut().modified_at = time;
self
}
fn add_base_comment(mut self, comment_id: u32) -> Self {
self.get_base_data_mut().comments.push(comment_id);
self

View File

@@ -118,7 +118,7 @@ pub trait Index {
/// // Retrieve the model with the assigned ID
/// let db_user = db.collection().get_by_id(user_id).expect("Failed to get user");
/// ```
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Default)]
pub struct BaseModelData {
/// Unique incremental ID - will be auto-generated by OurDB
///