/
proposals.rs
121 lines (94 loc) · 2.83 KB
/
proposals.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
use crate::db::models::proposals::{Category, Proposal, Proposer};
use crate::db::models::vote_options::VoteOptions;
use crate::utils::datetime::unix_timestamp_to_datetime;
use async_graphql::OutputJson;
#[async_graphql::Object]
impl Category {
pub async fn category_id(&self) -> &str {
&self.category_id
}
pub async fn category_name(&self) -> &str {
&self.category_name
}
pub async fn category_description(&self) -> &str {
&self.category_description
}
}
#[async_graphql::Object]
impl Proposer {
pub async fn proposer_name(&self) -> &str {
&self.proposer_name
}
pub async fn proposer_email(&self) -> &str {
&self.proposer_email
}
pub async fn proposer_url(&self) -> &str {
&self.proposer_url
}
}
#[async_graphql::Object]
impl Proposal {
pub async fn internal_id(&self) -> i32 {
self.internal_id
}
pub async fn category(&self) -> &Category {
&self.proposal_category
}
pub async fn proposal_id(&self) -> &str {
&self.proposal_id
}
pub async fn proposal_title(&self) -> &str {
&self.proposal_title
}
pub async fn proposal_summary(&self) -> &str {
&self.proposal_summary
}
pub async fn proposal_problem(&self) -> &str {
&self.proposal_problem
}
pub async fn proposal_solution(&self) -> &str {
&self.proposal_solution
}
pub async fn proposal_public_key(&self) -> &str {
&self.proposal_public_key
}
pub async fn proposal_funds(&self) -> i64 {
self.proposal_funds
}
pub async fn proposal_url(&self) -> &str {
&self.proposal_url
}
pub async fn proposal_files_url(&self) -> &str {
&self.proposal_files_url
}
pub async fn proposer(&self) -> &Proposer {
&self.proposer
}
pub async fn chain_proposal_id(&self) -> String {
String::from_utf8(self.chain_proposal_id.clone()).unwrap()
}
pub async fn chain_voteplan_id(&self) -> &str {
&self.chain_voteplan_id
}
pub async fn chain_proposal_index(&self) -> i64 {
self.chain_proposal_index
}
pub async fn chain_voteplan_payload(&self) -> &str {
&self.chain_voteplan_payload
}
pub async fn chain_vote_start_time(&self) -> String {
unix_timestamp_to_datetime(self.chain_vote_start_time).to_rfc3339()
}
pub async fn chain_vote_end_time(&self) -> String {
unix_timestamp_to_datetime(self.chain_vote_end_time).to_rfc3339()
}
pub async fn chain_committee_end_time(&self) -> String {
unix_timestamp_to_datetime(self.chain_committee_end_time).to_rfc3339()
}
pub async fn chain_vote_options(&self) -> OutputJson<&VoteOptions> {
OutputJson(&self.chain_vote_options)
}
pub async fn fund_id(&self) -> i32 {
self.fund_id
}
}