Fix ID bug

This commit is contained in:
Kiana Sheibani 2023-08-27 03:11:23 -04:00
parent 99217eedb6
commit 17c139f694
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
4 changed files with 88 additions and 1 deletions

View file

@ -13,6 +13,7 @@ cynic = { version = "3.2", features = ["http-surf"] }
surf = "2"
dirs = "5.0"
futures = "0.3"
serde = "1.0"
[build-dependencies]
cynic-codegen = "3.2"

View file

@ -1,2 +1,10 @@
pub mod search_games;
use schema::schema;
/// HACK: Unfortunately, start.gg seems to use integers for its ID type, whereas
/// cynic always assumes that IDs are strings. To get around that, we define a
/// new scalar type that serializes to u64.
#[derive(cynic::Scalar, Debug)]
pub struct ID(u64);

View file

@ -1,5 +1,6 @@
use schema::schema;
use super::ID;
// VARIABLES
@ -24,6 +25,6 @@ pub struct VideogameConnection {
#[derive(cynic::QueryFragment, Debug)]
pub struct Videogame {
pub id: Option<cynic::Id>
pub id: Option<ID>,
pub name: Option<String>,
}