diff --git a/src/commands/keys/delete.rs b/src/commands/keys/delete.rs index c8d9eba..cdefb26 100644 --- a/src/commands/keys/delete.rs +++ b/src/commands/keys/delete.rs @@ -10,7 +10,7 @@ use std::io::Write; use crate::{ commands::{AspmSubcommand, KeysEntityExt, KeysQueryResult}, - entities::keys::{Entity as KeysEntity, Model as KeysModel}, + entities::prelude::* }; /// Deletes a saved key, after asking for confirmation. @@ -27,10 +27,10 @@ pub struct KeysDeleteCommand { impl AspmSubcommand for KeysDeleteCommand { async fn execute(&self, state: crate::AspmState) -> Result<(), anyhow::Error> { // Fetch key from db - let entry = KeysEntity::query_key(&state.db, &self.key) + let entry = Keys::query_key(&state.db, &self.key) .await .context("Unable to query keys from database")?; - let key: KeysModel = match entry { + let key = match entry { KeysQueryResult::None => { eprintln!( "{style}No keys matching the given query were found{reset}", diff --git a/src/commands/keys/export.rs b/src/commands/keys/export.rs index b158c1f..fff9e25 100644 --- a/src/commands/keys/export.rs +++ b/src/commands/keys/export.rs @@ -11,7 +11,7 @@ use std::io::Write; use crate::{ commands::{AspmSubcommand, KeysEntityExt, KeysQueryResult}, - entities::keys::{Entity as KeysEntity, Model as KeysModel}, + entities::prelude::* }; #[derive(ValueEnum, Debug, Clone)] @@ -39,10 +39,10 @@ pub struct KeysExportCommand { impl AspmSubcommand for KeysExportCommand { async fn execute(&self, state: crate::AspmState) -> Result<(), anyhow::Error> { // Fetch key from db - let entry = KeysEntity::query_key(&state.db, &self.key) + let entry = Keys::query_key(&state.db, &self.key) .await .context("Unable to query keys from database")?; - let key: KeysModel = match entry { + let key = match entry { KeysQueryResult::None => { eprintln!( "{style}No keys matching the given query were found{reset}", diff --git a/src/commands/keys/list.rs b/src/commands/keys/list.rs index efc2de4..c1d8ff9 100644 --- a/src/commands/keys/list.rs +++ b/src/commands/keys/list.rs @@ -7,7 +7,7 @@ use sea_orm::EntityTrait; use std::io::Write; -use crate::{commands::AspmSubcommand, entities::keys}; +use crate::{commands::AspmSubcommand, entities::prelude::*}; /// A command to list all saved keys, along with their fingerprints and types #[derive(Parser, Debug)] @@ -16,7 +16,7 @@ pub struct KeysListCommand; #[async_trait::async_trait] impl AspmSubcommand for KeysListCommand { async fn execute(&self, state: crate::AspmState) -> Result<(), anyhow::Error> { - let entries = keys::Entity::find() + let entries = Keys::find() .all(&state.db) .await .context("Unable to read keys from database")?;