Skip to content

Commit 23dd060

Browse files
author
Ivo Georgiev
authored
Merge pull request #40 from AdExNetwork/issue-27-EventSubmition-EventSubmitionRule
Issue #27 EventSubmition & EventSubmitionRule
2 parents b377278 + 8a1006e commit 23dd060

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

sentry/src/domain/channel_fixtures.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub fn get_channel_spec(prefix: &str, validators_option: ValidatorsOption) -> Ch
9191
targeting: Vec::new(),
9292
min_targeting_score,
9393
// @TODO: `EventSubmission` fixture issue #27
94-
event_submission: EventSubmission {},
94+
event_submission: EventSubmission { allow: vec![] },
9595
created: Utc::now(),
9696
active_from: Some(Utc::now()),
9797
nonce,

sentry/src/domain/event_submission.rs

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
11
use serde::{Deserialize, Serialize};
22

33
#[derive(Serialize, Deserialize, Debug, Clone)]
4-
pub struct EventSubmission {}
4+
pub struct EventSubmission {
5+
#[serde(default)]
6+
pub allow: Vec<Rule>,
7+
}
8+
9+
#[derive(Serialize, Deserialize, Debug, Clone)]
10+
#[serde(rename_all = "camelCase")]
11+
pub struct Rule {
12+
#[serde(default)]
13+
pub uids: Option<Vec<String>>,
14+
#[serde(default)]
15+
pub rate_limit: Option<RateLimit>,
16+
}
17+
18+
#[derive(Serialize, Deserialize, Debug, Clone)]
19+
#[serde(rename_all = "camelCase")]
20+
pub struct RateLimit {
21+
/// "ip", "uid"
22+
#[serde(rename = "type")]
23+
pub limit_type: String,
24+
/// in milliseconds
25+
#[serde(rename = "timeframe")]
26+
pub time_frame: u64,
27+
}

0 commit comments

Comments
 (0)