From 2e447e87fddc4ce3f548465dc270678d3a94b1c6 Mon Sep 17 00:00:00 2001 From: Akulij Date: Sat, 31 May 2025 13:45:02 +0500 Subject: [PATCH] create Application.store_db to store by DB type --- src/db/application.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/db/application.rs b/src/db/application.rs index 150c5fc..556983b 100644 --- a/src/db/application.rs +++ b/src/db/application.rs @@ -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 { + let db = db.get_database().await; + let ci = db.collection::("applications"); + + ci.insert_one(&self).await?; + + Ok(self) + } }