modify api and serializer
This commit is contained in:
parent
d17fdfec77
commit
fff6725799
4 changed files with 7 additions and 5 deletions
|
@ -113,11 +113,12 @@ type Association {
|
||||||
|
|
||||||
type Avis {
|
type Avis {
|
||||||
attachment: File
|
attachment: File
|
||||||
|
claimant: Profile
|
||||||
dateQuestion: ISO8601DateTime!
|
dateQuestion: ISO8601DateTime!
|
||||||
dateReponse: ISO8601DateTime
|
dateReponse: ISO8601DateTime
|
||||||
expert: Profile
|
expert: Profile
|
||||||
id: ID!
|
id: ID!
|
||||||
instructeur: Profile!
|
instructeur: Profile! @deprecated(reason: "Utilisez le champ claimant à la place.")
|
||||||
question: String!
|
question: String!
|
||||||
reponse: String
|
reponse: String
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@ module Types
|
||||||
{ Extensions::Attachment => { attachment: :piece_justificative_file } }
|
{ 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
|
field :expert, Types::ProfileType, null: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -90,10 +90,10 @@ module Types
|
||||||
def avis(id: nil)
|
def avis(id: nil)
|
||||||
if id.present?
|
if id.present?
|
||||||
Loaders::Record
|
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))
|
.load(ApplicationRecord.id_from_typed_id(id))
|
||||||
else
|
else
|
||||||
Loaders::Association.for(object.class, avis: [:instructeur, :claimant]).load(object)
|
Loaders::Association.for(object.class, avis: [:expert, :claimant]).load(object)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ class SerializerService
|
||||||
reponse
|
reponse
|
||||||
dateQuestion
|
dateQuestion
|
||||||
dateReponse
|
dateReponse
|
||||||
instructeur {
|
claimant {
|
||||||
email
|
email
|
||||||
}
|
}
|
||||||
expert {
|
expert {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue