create Application.store_db to store by DB type
This commit is contained in:
parent
d749b57811
commit
2e447e87fd
@ -2,6 +2,7 @@ use chrono::{DateTime, FixedOffset, Local};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::DbResult;
|
||||
use super::DB;
|
||||
use crate::query_call_consume;
|
||||
use crate::CallDB;
|
||||
|
||||
@ -36,4 +37,13 @@ where
|
||||
|
||||
Ok(self)
|
||||
});
|
||||
|
||||
pub async fn store_db(self, db: &mut DB) -> DbResult<Self> {
|
||||
let db = db.get_database().await;
|
||||
let ci = db.collection::<Self>("applications");
|
||||
|
||||
ci.insert_one(&self).await?;
|
||||
|
||||
Ok(self)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user