1
0
Fork 0
mirror of https://codeberg.org/tyy/aspm synced 2024-12-22 20:39:29 -07:00

Use prelude

This commit is contained in:
Tyler Beckman 2024-01-28 14:53:21 -07:00
parent 4f83bb9a3f
commit db19e9ad69
Signed by: Ty
GPG key ID: 2813440C772555A4
3 changed files with 8 additions and 8 deletions

View file

@ -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}",

View file

@ -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}",

View file

@ -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")?;