From c4c262a5e9bfeb30bc0106d9ea51dfce7e4fa1f3 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 4 Sep 2024 16:44:43 +0100 Subject: refactor(remote): split into modules to make it easier to read --- src/lib/client.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/lib/client.rs') diff --git a/src/lib/client.rs b/src/lib/client.rs index ace880b..c29d4b9 100644 --- a/src/lib/client.rs +++ b/src/lib/client.rs @@ -38,6 +38,7 @@ use nostr_sqlite::SQLiteDatabase; use crate::{ get_dirs, + git::{Repo, RepoActions}, git_events::{ event_is_cover_letter, event_is_patch_set_root, event_is_revision_root, status_kinds, }, @@ -1572,6 +1573,17 @@ pub async fn get_all_proposal_patch_events_from_cache( .collect()) } +pub async fn get_event_from_cache_by_id(git_repo: &Repo, event_id: &EventId) -> Result { + Ok(get_events_from_cache( + git_repo.get_path()?, + vec![nostr::Filter::default().id(*event_id)], + ) + .await? + .first() + .context("cannot find event in cache")? + .clone()) +} + #[allow(clippy::module_name_repetitions)] #[allow(clippy::too_many_lines)] pub async fn send_events( -- cgit v1.2.3