[GraphQL] Use GraphQL::Types::BigInt instead of Int

This commit is contained in:
Paul Chavard 2020-01-28 16:26:02 +01:00
parent 42fd2a4774
commit 6030409b2f
4 changed files with 13 additions and 5 deletions

View file

@ -18,6 +18,12 @@ type Avis {
reponse: String reponse: String
} }
"""
Represents non-fractional signed whole numeric values. Since the value may
exceed the size of a 32-bit integer, it's encoded as a string.
"""
scalar BigInt
type CarteChamp implements Champ { type CarteChamp implements Champ {
geoAreas: [GeoArea!]! geoAreas: [GeoArea!]!
id: ID! id: ID!
@ -648,7 +654,7 @@ enum DossierState {
} }
type Entreprise { type Entreprise {
capitalSocial: Int! capitalSocial: BigInt!
codeEffectifEntreprise: String! codeEffectifEntreprise: String!
dateCreation: ISO8601Date! dateCreation: ISO8601Date!
formeJuridique: String! formeJuridique: String!
@ -730,7 +736,7 @@ type IntegerNumberChamp implements Champ {
La valeur du champ sous forme texte. La valeur du champ sous forme texte.
""" """
stringValue: String stringValue: String
value: Int value: BigInt
} }
type LinkedDropDownListChamp implements Champ { type LinkedDropDownListChamp implements Champ {

View file

@ -2,7 +2,7 @@ module Types::Champs
class IntegerNumberChampType < Types::BaseObject class IntegerNumberChampType < Types::BaseObject
implements Types::ChampType implements Types::ChampType
field :value, Int, null: true field :value, GraphQL::Types::BigInt, null: true
def value def value
if object.value.present? if object.value.present?

View file

@ -2,7 +2,7 @@ module Types
class PersonneMoraleType < Types::BaseObject class PersonneMoraleType < Types::BaseObject
class EntrepriseType < Types::BaseObject class EntrepriseType < Types::BaseObject
field :siren, String, null: false field :siren, String, null: false
field :capital_social, Int, null: false field :capital_social, GraphQL::Types::BigInt, null: false
field :numero_tva_intracommunautaire, String, null: false field :numero_tva_intracommunautaire, String, null: false
field :forme_juridique, String, null: false field :forme_juridique, String, null: false
field :forme_juridique_code, String, null: false field :forme_juridique_code, String, null: false

View file

@ -308,6 +308,7 @@ describe API::V2::GraphqlController do
entreprise { entreprise {
siren siren
dateCreation dateCreation
capitalSocial
} }
} }
} }
@ -330,7 +331,8 @@ describe API::V2::GraphqlController do
siegeSocial: dossier.etablissement.siege_social, siegeSocial: dossier.etablissement.siege_social,
entreprise: { entreprise: {
siren: dossier.etablissement.entreprise_siren, siren: dossier.etablissement.entreprise_siren,
dateCreation: dossier.etablissement.entreprise_date_creation.iso8601 dateCreation: dossier.etablissement.entreprise_date_creation.iso8601,
capitalSocial: dossier.etablissement.entreprise_capital_social.to_s
} }
} }
}) })