Skip to content

Commit c958c1e

Browse files
committed
feat: vote history object
1 parent 589044e commit c958c1e

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

catalyst-gateway/bin/src/service/api/legacy/v0/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ use poem_openapi::{
66
};
77

88
use crate::service::{
9-
common::{auth::none::NoAuthorization, tags::ApiTags},
9+
common::{
10+
auth::none::NoAuthorization, objects::legacy::vote_history::VoteHistoryItem, tags::ApiTags,
11+
},
1012
utilities::middleware::schema_validation::schema_version_validation,
1113
};
1214

@@ -103,7 +105,7 @@ impl V0Api {
103105
deprecated = true
104106
)]
105107
async fn proposals_post(
106-
&self, message: Json<Vec<proposals_post::dto::VotingHistoryItem>>, _auth: NoAuthorization,
108+
&self, message: Json<Vec<VoteHistoryItem>>, _auth: NoAuthorization,
107109
) -> proposals_post::AllResponses {
108110
proposals_post::endpoint(message.0).await
109111
}

catalyst-gateway/bin/src/service/api/legacy/v0/proposals_get.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ pub(crate) type AllResponses = WithErrorResponses<Responses>;
1717
/// The service endpoint
1818
#[allow(clippy::unused_async)]
1919
pub(crate) async fn endpoint() -> AllResponses {
20-
Responses::Ok(Json(Vec::new())).into()
20+
Responses::Ok(Json(Default::default())).into()
2121
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Implementation of the GET /setting endpoint
22
use poem_openapi::{payload::Json, ApiResponse};
33

4+
use super::VoteHistoryItem;
45
use crate::service::common::{objects::legacy::proposal::Proposal, responses::WithErrorResponses};
56

67
/// Endpoint responses
@@ -16,21 +17,6 @@ pub(crate) type AllResponses = WithErrorResponses<Responses>;
1617

1718
/// The service endpoint
1819
#[allow(clippy::unused_async)]
19-
pub(crate) async fn endpoint(_message: Vec<dto::VotingHistoryItem>) -> AllResponses {
20+
pub(crate) async fn endpoint(_message: Vec<VoteHistoryItem>) -> AllResponses {
2021
Responses::Ok(Json(Vec::new())).into()
2122
}
22-
23-
/// The data transfer objects over HTTP
24-
pub(crate) mod dto {
25-
use poem_openapi::Object;
26-
27-
/// An option item to specify proposal to query.
28-
#[allow(clippy::missing_docs_in_private_items)]
29-
#[derive(Object, Default)]
30-
pub(crate) struct VotingHistoryItem {
31-
#[oai(validator(max_length = 256, min_length = 0, pattern = "[A-Za-z0-9_-]"))]
32-
vote_plan_id: String,
33-
#[oai(validator(minimum(value = "0"), maximum(value = "4294967295")))]
34-
indexes: u32,
35-
}
36-
}

catalyst-gateway/bin/src/service/common/objects/legacy/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub(crate) mod proposal;
1313
pub(crate) mod review;
1414
pub(crate) mod settings_info;
1515
pub(crate) mod stake_public_key;
16+
pub(crate) mod vote_history;
1617
pub(crate) mod vote_plan;
1718
pub(crate) mod voter_group_id;
1819
pub(crate) mod voter_info;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//! Define the Vote history
2+
3+
use poem_openapi::Object;
4+
5+
/// An option item to specify proposal to query.
6+
#[allow(clippy::missing_docs_in_private_items)]
7+
#[derive(Object, Default)]
8+
pub(crate) struct VoteHistoryItem {
9+
#[oai(validator(max_length = 256, min_length = 0, pattern = "[A-Za-z0-9_-]"))]
10+
vote_plan_id: String,
11+
#[oai(validator(minimum(value = "0"), maximum(value = "4294967295")))]
12+
indexes: u32,
13+
}

0 commit comments

Comments
 (0)