Skip to content

Commit 4616cbd

Browse files
Serialize issue comment ID as unsigned
1 parent 32092c8 commit 4616cbd

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/domain/github.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ pub struct Issue {
153153
#[table_name = "issuecomment"]
154154
#[changeset_options(treat_none_as_null = "true")]
155155
pub struct IssueComment {
156+
#[serde(serialize_with = "super::unsigned")]
156157
pub id: i32,
157158
pub fk_issue: i32,
158159
pub fk_user: i32,

src/domain/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@
22
pub mod github;
33
pub mod rfcbot;
44
pub mod schema;
5+
6+
fn unsigned<S>(v: &i32, s: S) -> Result<S::Ok, S::Error>
7+
where
8+
S: serde::ser::Serializer,
9+
{
10+
s.serialize_u32(*v as u32)
11+
}

src/domain/rfcbot.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ pub struct Poll {
2323
pub id: i32,
2424
pub fk_issue: i32,
2525
pub fk_initiator: i32,
26+
#[serde(serialize_with = "super::unsigned")]
2627
pub fk_initiating_comment: i32,
28+
#[serde(serialize_with = "super::unsigned")]
2729
pub fk_bot_tracking_comment: i32,
2830
pub poll_question: String,
2931
pub poll_created_at: NaiveDateTime,
@@ -71,8 +73,10 @@ pub struct FcpProposal {
7173
pub id: i32,
7274
pub fk_issue: i32,
7375
pub fk_initiator: i32,
76+
#[serde(serialize_with = "super::unsigned")]
7477
pub fk_initiating_comment: i32,
7578
pub disposition: String,
79+
#[serde(serialize_with = "super::unsigned")]
7680
pub fk_bot_tracking_comment: i32,
7781
pub fcp_start: Option<NaiveDateTime>,
7882
pub fcp_closed: bool,

0 commit comments

Comments
 (0)