modify api and serializer

This commit is contained in:
kara Diaby 2021-03-22 10:25:47 +01:00
parent d17fdfec77
commit fff6725799
4 changed files with 7 additions and 5 deletions

View file

@ -113,11 +113,12 @@ type Association {
type Avis {
attachment: File
claimant: Profile
dateQuestion: ISO8601DateTime!
dateReponse: ISO8601DateTime
expert: Profile
id: ID!
instructeur: Profile!
instructeur: Profile! @deprecated(reason: "Utilisez le champ claimant à la place.")
question: String!
reponse: String
}

View file

@ -11,7 +11,8 @@ module Types
{ Extensions::Attachment => { attachment: :piece_justificative_file } }
]
field :instructeur, Types::ProfileType, null: false, method: :claimant
field :instructeur, Types::ProfileType, null: false, method: :claimant, deprecation_reason: "Utilisez le champ claimant à la place."
field :claimant, Types::ProfileType, null: true
field :expert, Types::ProfileType, null: true
end
end

View file

@ -90,10 +90,10 @@ module Types
def avis(id: nil)
if id.present?
Loaders::Record
.for(Avis, where: { dossier: object }, includes: [:instructeur, :claimant], array: true)
.for(Avis, where: { dossier: object }, includes: [:expert, :claimant], array: true)
.load(ApplicationRecord.id_from_typed_id(id))
else
Loaders::Association.for(object.class, avis: [:instructeur, :claimant]).load(object)
Loaders::Association.for(object.class, avis: [:expert, :claimant]).load(object)
end
end

View file

@ -109,7 +109,7 @@ class SerializerService
reponse
dateQuestion
dateReponse
instructeur {
claimant {
email
}
expert {