use entity::{collection, profile};
use entity::profile::Entity as Profile;
-use entity::collection::Entity as Collection;
+use entity::collection::{CollectionType, Entity as Collection};
pub struct Backend {
rt: Arc<Runtime>,
let inserted = active.insert(&self.db).await?;
+ // create some initial notebooks
+ let insert_notebooks = collection::ActiveModel {
+ profile_id: Set(inserted.id),
+ name: Set("Notebooks".to_string()),
+ parent: Set("".to_string()),
+ icon: Set("".to_string()),
+ kind: Set(CollectionType::Notebook),
+
+ ..Default::default()
+ };
+ let notebooks = insert_notebooks.insert(&self.db).await?;
+
+ let insert_notes = collection::ActiveModel {
+ profile_id: Set(inserted.id),
+ name: Set("Notes".to_string()),
+ parent: Set("/Notebooks".to_string()),
+ icon: Set("".to_string()),
+ kind: Set(CollectionType::Notebook),
+
+ ..Default::default()
+ };
+ insert_notes.insert(&self.db).await?;
+
Ok::<profile::Model, DbErr>(inserted)
})?;