Skip to content

Commit

Permalink
fix(graphql): 🐛 fix Juniper objects @George-Miao
Browse files Browse the repository at this point in the history
  • Loading branch information
Srylax committed May 7, 2024
1 parent 38ac7e4 commit b45e87b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ impl<'de> Deserialize<'de> for Edge {
}

#[cfg(feature = "graphql")]
#[juniper::object]
#[juniper::graphql_object]
impl Edge {
fn cursor(&self) -> String {
self.cursor.to_owned()
self.0.to_string()
}
}

Expand Down Expand Up @@ -128,7 +128,7 @@ pub struct PageInfo {
}

#[cfg(feature = "graphql")]
#[juniper::object]
#[juniper::graphql_object]
impl PageInfo {
fn has_next_page(&self) -> bool {
self.has_next_page
Expand All @@ -139,11 +139,11 @@ impl PageInfo {
}

fn start_cursor(&self) -> Option<String> {
self.start_cursor.to_owned()
self.start_cursor.as_ref().map(ToString::to_string)
}

fn end_cursor(&self) -> Option<String> {
self.next_cursor.to_owned()
self.end_cursor.as_ref().map(ToString::to_string)
}
}

Expand All @@ -162,7 +162,7 @@ pub struct FindResult<T> {
}

/// Cursor to an item with direction information.
/// Serializing pretains the direction Information.
/// Serializing pertains the direction Information.
/// To send only the Cursor use `to_string` which drops the direction information
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[allow(clippy::exhaustive_enums)] // If there would ever be more Variants we would want the Code to break
Expand Down

0 comments on commit b45e87b

Please sign in to comment.