Skip to content

Commit

Permalink
RPPL-2704 [Post MVP] Cleanup Advertising RPC handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshihcst committed Nov 21, 2024
1 parent 122e8c7 commit 82bd30b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions core/main/src/firebolt/handlers/advertising_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
//
use crate::{
firebolt::rpc::RippleRPCProvider, processor::storage::storage_manager::StorageManager,
service::apps::app_events::{AppEventDecorationError, AppEventDecorator},
state::platform_state::PlatformState, utils::rpc_utils::rpc_err,
};
use base64::{engine::general_purpose::STANDARD as base64, Engine};
Expand Down Expand Up @@ -149,6 +150,24 @@ async fn get_advertisting_policy(platform_state: &PlatformState) -> AdvertisingP
}
}

#[derive(Clone)]
struct AdvertisingPolicyEventDecorator {}
#[async_trait]
impl AppEventDecorator for AdvertisingPolicyEventDecorator {
async fn decorate(
&self,
ps: &PlatformState,
_ctx: &CallContext,
_event_name: &str,
_val_in: &Value,
) -> Result<Value, AppEventDecorationError> {
Ok(serde_json::to_value(get_advertisting_policy(ps).await)?)
}
fn dec_clone(&self) -> Box<dyn AppEventDecorator + Send + Sync> {
Box::new(self.clone())
}
}

pub struct AdvertisingImpl {
pub state: PlatformState,
}
Expand Down

0 comments on commit 82bd30b

Please sign in to comment.