Skip to content

Commit

Permalink
Serialize issue comment ID as unsigned
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Jul 21, 2024
1 parent 32092c8 commit 4616cbd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/domain/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ pub struct Issue {
#[table_name = "issuecomment"]
#[changeset_options(treat_none_as_null = "true")]
pub struct IssueComment {
#[serde(serialize_with = "super::unsigned")]
pub id: i32,
pub fk_issue: i32,
pub fk_user: i32,
Expand Down
7 changes: 7 additions & 0 deletions src/domain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@
pub mod github;
pub mod rfcbot;
pub mod schema;

fn unsigned<S>(v: &i32, s: S) -> Result<S::Ok, S::Error>
where
S: serde::ser::Serializer,
{
s.serialize_u32(*v as u32)
}
4 changes: 4 additions & 0 deletions src/domain/rfcbot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ pub struct Poll {
pub id: i32,
pub fk_issue: i32,
pub fk_initiator: i32,
#[serde(serialize_with = "super::unsigned")]
pub fk_initiating_comment: i32,
#[serde(serialize_with = "super::unsigned")]
pub fk_bot_tracking_comment: i32,
pub poll_question: String,
pub poll_created_at: NaiveDateTime,
Expand Down Expand Up @@ -71,8 +73,10 @@ pub struct FcpProposal {
pub id: i32,
pub fk_issue: i32,
pub fk_initiator: i32,
#[serde(serialize_with = "super::unsigned")]
pub fk_initiating_comment: i32,
pub disposition: String,
#[serde(serialize_with = "super::unsigned")]
pub fk_bot_tracking_comment: i32,
pub fcp_start: Option<NaiveDateTime>,
pub fcp_closed: bool,
Expand Down

0 comments on commit 4616cbd

Please sign in to comment.