Clean up DB refactor access (#192)

This commit is contained in:
Gregory Schier
2025-03-26 07:54:58 -07:00
committed by GitHub
parent 006284b99c
commit b7f62b78b1
39 changed files with 470 additions and 705 deletions

View File

@@ -1,13 +1,13 @@
use crate::db_context::DbContext;
use crate::error::Result;
use crate::manager::DbContext;
use crate::models::{Plugin, PluginIden};
use crate::queries_legacy::UpdateSource;
use crate::util::UpdateSource;
impl<'a> DbContext<'a> {
pub fn get_plugin(&self, id: &str) -> Result<Plugin> {
self.find_one(PluginIden::Id, id)
}
pub fn list_plugins(&self) -> Result<Vec<Plugin>> {
self.find_all()
}
@@ -20,7 +20,7 @@ impl<'a> DbContext<'a> {
let plugin = self.get_plugin(id)?;
self.delete_plugin(&plugin, source)
}
pub fn upsert_plugin(&self, plugin: &Plugin, source: &UpdateSource) -> Result<Plugin> {
self.upsert(plugin, source)
}