demarches-normaliennes/app/graphql/api/v2/stored_query.rb

935 lines
18 KiB
Ruby
Raw Normal View History

class API::V2::StoredQuery
2023-04-04 14:45:22 +02:00
def self.get(query_id)
case query_id
when 'ds-query-v2'
QUERY_V2
when 'ds-mutation-v2'
MUTATION_V2
when 'introspection'
GraphQL::Introspection::INTROSPECTION_QUERY
else
raise GraphQL::ExecutionError.new("No query with id \"#{query_id}\"", extensions: { code: :bad_request })
end
end
QUERY_V2 = <<-'GRAPHQL'
query getDemarche(
$demarcheNumber: Int!
$state: DossierState
$order: Order
$first: Int
$after: String
$archived: Boolean
$revision: ID
$createdSince: ISO8601DateTime
$updatedSince: ISO8601DateTime
$pendingDeletedOrder: Order
$pendingDeletedFirst: Int
$pendingDeletedAfter: String
$pendingDeletedSince: ISO8601DateTime
2023-04-11 10:11:43 +02:00
$deletedOrder: Order
$deletedFirst: Int
$deletedAfter: String
$deletedSince: ISO8601DateTime
$includeGroupeInstructeurs: Boolean = false
$includeDossiers: Boolean = false
$includePendingDeletedDossiers: Boolean = false
2023-04-11 10:11:43 +02:00
$includeDeletedDossiers: Boolean = false
$includeRevision: Boolean = false
$includeService: Boolean = false
$includeChamps: Boolean = true
$includeAnotations: Boolean = true
$includeTraitements: Boolean = true
$includeInstructeurs: Boolean = true
$includeAvis: Boolean = false
$includeMessages: Boolean = false
$includeCorrections: Boolean = false
$includeGeometry: Boolean = false
) {
demarche(number: $demarcheNumber) {
id
number
title
state
declarative
dateCreation
dateFermeture
activeRevision @include(if: $includeRevision) {
...RevisionFragment
}
groupeInstructeurs @include(if: $includeGroupeInstructeurs) {
...GroupeInstructeurFragment
}
service @include(if: $includeService) {
...ServiceFragment
}
dossiers(
state: $state
order: $order
first: $first
after: $after
archived: $archived
createdSince: $createdSince
updatedSince: $updatedSince
revision: $revision
) @include(if: $includeDossiers) {
pageInfo {
...PageInfoFragment
}
nodes {
...DossierFragment
}
}
pendingDeletedDossiers(
order: $pendingDeletedOrder
first: $pendingDeletedFirst
after: $pendingDeletedAfter
deletedSince: $pendingDeletedSince
) @include(if: $includePendingDeletedDossiers) {
pageInfo {
...PageInfoFragment
}
nodes {
...DeletedDossierFragment
}
}
deletedDossiers(
order: $deletedOrder
first: $deletedFirst
after: $deletedAfter
deletedSince: $deletedSince
) @include(if: $includeDeletedDossiers) {
pageInfo {
...PageInfoFragment
}
nodes {
...DeletedDossierFragment
}
}
}
}
query getGroupeInstructeur(
$groupeInstructeurNumber: Int!
$state: DossierState
$order: Order
$first: Int
$after: String
$archived: Boolean
$revision: ID
$createdSince: ISO8601DateTime
$updatedSince: ISO8601DateTime
2023-04-11 10:11:43 +02:00
$pendingDeletedOrder: Order
$pendingDeletedFirst: Int
$pendingDeletedAfter: String
$pendingDeletedSince: ISO8601DateTime
$deletedOrder: Order
$deletedFirst: Int
$deletedAfter: String
$deletedSince: ISO8601DateTime
$includeDossiers: Boolean = false
2023-04-11 10:11:43 +02:00
$includePendingDeletedDossiers: Boolean = false
$includeDeletedDossiers: Boolean = false
$includeChamps: Boolean = true
$includeAnotations: Boolean = true
$includeTraitements: Boolean = true
$includeInstructeurs: Boolean = true
$includeAvis: Boolean = false
$includeMessages: Boolean = false
$includeCorrections: Boolean = false
$includeGeometry: Boolean = false
) {
groupeInstructeur(number: $groupeInstructeurNumber) {
id
number
label
instructeurs @include(if: $includeInstructeurs) {
id
email
}
dossiers(
state: $state
order: $order
first: $first
after: $after
archived: $archived
createdSince: $createdSince
updatedSince: $updatedSince
revision: $revision
) @include(if: $includeDossiers) {
pageInfo {
...PageInfoFragment
}
nodes {
...DossierFragment
}
}
2023-04-11 10:11:43 +02:00
pendingDeletedDossiers(
order: $pendingDeletedOrder
first: $pendingDeletedFirst
after: $pendingDeletedAfter
deletedSince: $pendingDeletedSince
) @include(if: $includePendingDeletedDossiers) {
pageInfo {
...PageInfoFragment
}
nodes {
...DeletedDossierFragment
}
}
deletedDossiers(
order: $deletedOrder
first: $deletedFirst
after: $deletedAfter
deletedSince: $deletedSince
) @include(if: $includeDeletedDossiers) {
pageInfo {
...PageInfoFragment
}
nodes {
...DeletedDossierFragment
}
}
}
}
query getDossier(
$dossierNumber: Int!
$includeRevision: Boolean = false
$includeService: Boolean = false
$includeChamps: Boolean = true
$includeAnotations: Boolean = true
$includeTraitements: Boolean = true
$includeInstructeurs: Boolean = true
$includeAvis: Boolean = false
$includeMessages: Boolean = false
$includeCorrections: Boolean = false
$includeGeometry: Boolean = false
) {
dossier(number: $dossierNumber) {
...DossierFragment
demarche {
...DemarcheDescriptorFragment
}
}
}
query getDemarcheDescriptor(
$demarche: FindDemarcheInput!
$includeRevision: Boolean = false
$includeService: Boolean = false
) {
demarcheDescriptor(demarche: $demarche) {
...DemarcheDescriptorFragment
}
}
fragment ServiceFragment on Service {
nom
siret
organisme
typeOrganisme
}
fragment GroupeInstructeurFragment on GroupeInstructeur {
id
number
label
instructeurs @include(if: $includeInstructeurs) {
id
email
}
}
fragment DossierFragment on Dossier {
__typename
id
number
archived
state
dateDerniereModification
dateDepot
datePassageEnConstruction
datePassageEnInstruction
dateTraitement
dateExpiration
dateSuppressionParUsager
dateDerniereCorrectionEnAttente @include(if: $includeCorrections)
motivation
motivationAttachment {
...FileFragment
}
attestation {
...FileFragment
}
pdf {
...FileFragment
}
usager {
email
}
connectionUsager
groupeInstructeur {
...GroupeInstructeurFragment
}
demandeur {
__typename
2023-04-11 10:11:43 +02:00
...PersonnePhysiqueFragment
...PersonneMoraleFragment
2023-04-11 10:11:43 +02:00
...PersonneMoraleIncompleteFragment
}
demarche {
revision {
id
}
}
instructeurs @include(if: $includeInstructeurs) {
id
email
}
traitements @include(if: $includeTraitements) {
state
emailAgentTraitant
dateTraitement
motivation
}
champs @include(if: $includeChamps) {
...ChampFragment
...RootChampFragment
}
annotations @include(if: $includeAnotations) {
...ChampFragment
...RootChampFragment
}
avis @include(if: $includeAvis) {
...AvisFragment
}
messages @include(if: $includeMessages) {
...MessageFragment
}
}
fragment DemarcheDescriptorFragment on DemarcheDescriptor {
id
number
title
description
state
declarative
dateCreation
datePublication
dateDerniereModification
dateDepublication
dateFermeture
notice { url }
deliberation { url }
demarcheURL
cadreJuridiqueURL
service @include(if: $includeService) {
...ServiceFragment
}
revision @include(if: $includeRevision) {
...RevisionFragment
}
}
fragment DeletedDossierFragment on DeletedDossier {
id
number
dateSupression
state
reason
}
fragment RevisionFragment on Revision {
id
datePublication
champDescriptors {
...ChampDescriptorFragment
... on RepetitionChampDescriptor {
champDescriptors {
...ChampDescriptorFragment
}
}
}
annotationDescriptors {
...ChampDescriptorFragment
... on RepetitionChampDescriptor {
champDescriptors {
...ChampDescriptorFragment
}
}
}
}
fragment ChampDescriptorFragment on ChampDescriptor {
__typename
id
label
description
required
... on DropDownListChampDescriptor {
options
otherOption
}
... on MultipleDropDownListChampDescriptor {
options
}
... on LinkedDropDownListChampDescriptor {
options
}
... on PieceJustificativeChampDescriptor {
fileTemplate {
...FileFragment
}
}
... on ExplicationChampDescriptor {
collapsibleExplanationEnabled
collapsibleExplanationText
}
}
fragment AvisFragment on Avis {
id
question
reponse
dateQuestion
dateReponse
claimant {
email
}
expert {
email
}
attachments {
...FileFragment
}
}
fragment MessageFragment on Message {
id
email
body
createdAt
attachments {
...FileFragment
}
correction @include(if: $includeCorrections) {
reason
dateResolution
}
}
fragment GeoAreaFragment on GeoArea {
id
source
description
geometry @include(if: $includeGeometry) {
type
coordinates
}
... on ParcelleCadastrale {
commune
numero
section
prefixe
surface
}
}
fragment RootChampFragment on Champ {
... on RepetitionChamp {
rows {
champs {
...ChampFragment
}
}
}
... on CarteChamp {
geoAreas {
...GeoAreaFragment
}
}
... on DossierLinkChamp {
dossier {
id
number
state
}
}
}
fragment ChampFragment on Champ {
id
__typename
label
stringValue
updatedAt
... on DateChamp {
date
}
... on DatetimeChamp {
datetime
}
... on CheckboxChamp {
checked: value
}
... on DecimalNumberChamp {
decimalNumber: value
}
... on IntegerNumberChamp {
integerNumber: value
}
... on CiviliteChamp {
civilite: value
}
... on LinkedDropDownListChamp {
primaryValue
secondaryValue
}
... on MultipleDropDownListChamp {
values
}
... on PieceJustificativeChamp {
files {
...FileFragment
}
}
... on AddressChamp {
address {
...AddressFragment
}
commune {
...CommuneFragment
}
departement {
...DepartementFragment
}
}
... on EpciChamp {
epci {
2023-04-11 10:11:43 +02:00
...EpciFragment
}
departement {
...DepartementFragment
}
}
... on CommuneChamp {
commune {
...CommuneFragment
}
departement {
...DepartementFragment
}
}
... on DepartementChamp {
departement {
...DepartementFragment
}
}
... on RegionChamp {
region {
2023-04-11 10:11:43 +02:00
...RegionFragment
}
}
2022-12-21 17:35:05 +01:00
... on PaysChamp {
pays {
2023-04-11 10:11:43 +02:00
...PaysFragment
2022-12-21 17:35:05 +01:00
}
}
... on SiretChamp {
etablissement {
...PersonneMoraleFragment
}
}
}
fragment PersonneMoraleFragment on PersonneMorale {
siret
siegeSocial
naf
libelleNaf
address {
...AddressFragment
}
entreprise {
siren
capitalSocial
numeroTvaIntracommunautaire
formeJuridique
formeJuridiqueCode
nomCommercial
raisonSociale
siretSiegeSocial
codeEffectifEntreprise
dateCreation
nom
prenom
attestationFiscaleAttachment {
...FileFragment
}
attestationSocialeAttachment {
...FileFragment
}
}
association {
rna
titre
objet
dateCreation
dateDeclaration
datePublication
}
}
2023-04-11 10:11:43 +02:00
fragment PersonneMoraleIncompleteFragment on PersonneMoraleIncomplete {
siret
}
fragment PersonnePhysiqueFragment on PersonnePhysique {
civilite
nom
prenom
}
fragment FileFragment on File {
__typename
filename
contentType
checksum
byteSize: byteSizeBigInt
url
createdAt
}
fragment AddressFragment on Address {
label
type
streetAddress
streetNumber
streetName
postalCode
cityName
cityCode
departmentName
departmentCode
regionName
regionCode
}
2023-04-11 10:11:43 +02:00
fragment PaysFragment on Pays {
name
code
}
fragment RegionFragment on Region {
name
code
}
fragment DepartementFragment on Departement {
name
code
}
2023-04-11 10:11:43 +02:00
fragment EpciFragment on Epci {
name
code
}
fragment CommuneFragment on Commune {
name
code
postalCode
}
fragment PageInfoFragment on PageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
GRAPHQL
MUTATION_V2 = <<-'GRAPHQL'
mutation dossierArchiver($input: DossierArchiverInput!) {
dossierArchiver(input: $input) {
dossier {
id
archived
}
errors {
message
}
}
}
mutation dossierPasserEnInstruction($input: DossierPasserEnInstructionInput!) {
dossierPasserEnInstruction(input: $input) {
dossier {
id
state
}
errors {
message
}
}
}
mutation dossierRepasserEnConstruction(
$input: DossierRepasserEnConstructionInput!
) {
dossierRepasserEnConstruction(input: $input) {
dossier {
id
state
}
errors {
message
}
}
}
mutation dossierAccepter($input: DossierAccepterInput!) {
dossierAccepter(input: $input) {
dossier {
id
state
attestation {
url
}
}
errors {
message
}
}
}
mutation dossierRefuser($input: DossierRefuserInput!) {
dossierRefuser(input: $input) {
dossier {
id
state
}
errors {
message
}
}
}
mutation dossierClasserSansSuite($input: DossierClasserSansSuiteInput!) {
dossierClasserSansSuite(input: $input) {
dossier {
id
state
}
errors {
message
}
}
}
mutation dossierRepasserEnInstruction(
$input: DossierRepasserEnInstructionInput!
) {
dossierRepasserEnInstruction(input: $input) {
dossier {
id
state
}
errors {
message
}
}
}
mutation dossierEnvoyerMessage($input: DossierEnvoyerMessageInput!) {
dossierEnvoyerMessage(input: $input) {
message {
id
createdAt
}
errors {
message
}
}
}
mutation dossierModifierAnnotationText(
$input: DossierModifierAnnotationTextInput!
) {
dossierModifierAnnotationText(input: $input) {
annotation {
id
value: stringValue
}
errors {
message
}
}
}
mutation dossierModifierAnnotationCheckbox(
$input: DossierModifierAnnotationCheckboxInput!
) {
dossierModifierAnnotationCheckbox(input: $input) {
annotation {
id
... on CheckboxChamp {
value
}
}
errors {
message
}
}
}
mutation dossierModifierAnnotationDate(
$input: DossierModifierAnnotationDateInput!
) {
dossierModifierAnnotationDate(input: $input) {
annotation {
id
... on DateChamp {
value: date
}
}
errors {
message
}
}
}
mutation dossierModifierAnnotationDateTime(
$input: DossierModifierAnnotationDatetimeInput!
) {
dossierModifierAnnotationDatetime(input: $input) {
annotation {
id
... on DatetimeChamp {
value: datetime
}
}
errors {
message
}
}
}
mutation dossierModifierAnnotationIntegerNumber(
$input: DossierModifierAnnotationIntegerNumberInput!
) {
dossierModifierAnnotationIntegerNumber(input: $input) {
annotation {
id
... on IntegerNumberChamp {
value
}
}
errors {
message
}
}
}
mutation dossierModifierAnnotationAjouterLigne(
$input: DossierModifierAnnotationAjouterLigneInput!
) {
dossierModifierAnnotationAjouterLigne(input: $input) {
annotation {
id
}
errors {
message
}
}
}
mutation createDirectUpload($input: CreateDirectUploadInput!) {
createDirectUpload(input: $input) {
directUpload {
signedBlobId
headers
url
}
}
}
mutation groupeInstructeurModifier($input: GroupeInstructeurModifierInput!) {
groupeInstructeurModifier(input: $input) {
groupeInstructeur {
id
}
errors {
message
}
}
}
mutation groupeInstructeurCreer($input: GroupeInstructeurCreerInput!, $includeInstructeurs: Boolean = false) {
groupeInstructeurCreer(input: $input) {
groupeInstructeur {
id
instructeurs @include(if: $includeInstructeurs) {
id
email
}
}
errors {
message
}
warnings {
message
}
}
}
mutation groupeInstructeurAjouterInstructeurs($input: GroupeInstructeurAjouterInstructeursInput!, $includeInstructeurs: Boolean = false) {
groupeInstructeurAjouterInstructeurs(input: $input) {
groupeInstructeur {
id
instructeurs @include(if: $includeInstructeurs) {
id
email
}
}
errors {
message
}
warnings {
message
}
}
}
mutation groupeInstructeurSupprimerInstructeurs($input: GroupeInstructeurSupprimerInstructeursInput!, $includeInstructeurs: Boolean = false) {
groupeInstructeurSupprimerInstructeurs(input: $input) {
groupeInstructeur {
id
instructeurs @include(if: $includeInstructeurs) {
id
email
}
}
errors {
message
}
}
}
mutation demarcheCloner($input: DemarcheClonerInput!) {
demarcheCloner(input: $input) {
demarche {
id
number
}
errors {
message
}
}
}
GRAPHQL
end