From 82bd30b0b488a4b25a312fc2d9da4256ca7418b2 Mon Sep 17 00:00:00 2001 From: Sakshi Gupta Date: Thu, 21 Nov 2024 10:41:58 -0800 Subject: [PATCH] RPPL-2704 [Post MVP] Cleanup Advertising RPC handlers --- .../src/firebolt/handlers/advertising_rpc.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/main/src/firebolt/handlers/advertising_rpc.rs b/core/main/src/firebolt/handlers/advertising_rpc.rs index fd0c405d7..79fa34495 100644 --- a/core/main/src/firebolt/handlers/advertising_rpc.rs +++ b/core/main/src/firebolt/handlers/advertising_rpc.rs @@ -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}; @@ -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 { + Ok(serde_json::to_value(get_advertisting_policy(ps).await)?) + } + fn dec_clone(&self) -> Box { + Box::new(self.clone()) + } +} + pub struct AdvertisingImpl { pub state: PlatformState, }