From 136ad52e7d40c170b8015191cb630b5aae1701c0 Mon Sep 17 00:00:00 2001 From: Artemy Date: Wed, 27 Jul 2022 12:41:51 +0300 Subject: [PATCH] feat: function to initialize personal library when signup (OS-25) --- src/core.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/core.rs b/src/core.rs index ddca58b..0fea2b5 100644 --- a/src/core.rs +++ b/src/core.rs @@ -112,6 +112,19 @@ impl Core { } } + async fn create_personal_library(&self, name: &String) { + self.personal_libraries + .insert_one( + doc! { + "name":name, + "apps":[] + }, + None, + ) + .await + .unwrap(); + } + pub async fn get_reviews(&self, app_name_id: &String) -> Vec { self.get_collection_with_params(&self.reviews, doc! {"app_name_id":app_name_id}) .await @@ -342,6 +355,7 @@ impl Core { let response = self.users.insert_one(&auth_info, None).await; match response { Ok(_) => { + self.create_personal_library(&user.name).await; json! ({ "code":"ok", "token":token