waterline-graphql icon indicating copy to clipboard operation
waterline-graphql copied to clipboard

Unable to filter by nested model

Open pisix opened this issue 6 years ago • 0 comments

I have two models : medecin.js

module.exports = { autoPK: false, autoCreatedAt: false, autoUpdatedAt: false, tableName:'medecin', attributes: { id:{ type:'integer', autoIncrement:true, unique:true, index:true, columnName:'id_medecin', primaryKey:true }, specialite:{ model:'specialite', columnName:'id_specialite' } }, associations: [ { alias: "specialite", type: "model", model: "specialite" } ] };

and

specialite.js module.exports = { autoPK: false, autoCreatedAt: false, autoUpdatedAt: false, tablename:'specialite', attributes: { id:{ type:'integer', autoIncrement:true, unique:true, index:true, columnName:'id_specialite', primaryKey:true }, code:{ type:"string", columnName:"code", notNull:true, index:true }, medecin: { collection: 'medecin', via: 'specialite' } }, associations: [ { alias: "medecin", type: "collection", collection: "medecin", via: "specialite" } ] };

I want to filter 'medecin' by 'specialite' code so I do this :

{ medecins(sort:"ville ASC" ) { ville specialite(code:"dupont" ) { code libelle } } } But I got this error

{ errors: [ { GraphQLError: Unknown argument "code" on field "specialite" of type "Medecin". .... message: 'Unknown argument "code" on field "specialite" of type "Medecin".', locations: [Array], path: undefined } ] }

how can I fix it ?

pisix avatar Feb 12 '18 11:02 pisix