vuex-orm / plugin-graphql

Vuex ORM persistence plugin to sync the store against a GraphQL API.
https://vuex-orm.github.io/plugin-graphql/
MIT License
227 stars 52 forks source link

Custom query not working returning Couldn't find Type of name UserInput in the GraphQL Schema. #162

Open davidubanyi opened 3 years ago

davidubanyi commented 3 years ago

Hi please I'm trying to return data from a custom query but the Type being generated by the plugin is wrong

My vue store index.js `import Vue from "vue"; import Vuex from "vuex"; import VuexORM from "@vuex-orm/core"; import VuexORMGraphQL from "@vuex-orm/plugin-graphql"; import VuexPersistence from 'vuex-persist'; import { DefaultAdapter, ConnectionMode, ArgumentMode } from "@vuex-orm/plugin-graphql"; import database from "@/database";

class CustomAdapter extends DefaultAdapter { // Your code here

// Example getConnectionMode() { return ConnectionMode.PLAIN; } getArgumentMode() { return ArgumentMode.TYPE; } }

const vuexLocal = new VuexPersistence({ storage: window.localStorage, key: "emr-app" });

Vue.use(Vuex); VuexORM.use(VuexORMGraphQL, { database, url: "***", adapter: new CustomAdapter(), debug: true,

});

const store = new Vuex.Store({ plugins: [VuexORM.install(database), vuexLocal.plugin] });

export default store; the query I'm running await User.customQuery({ name: "GetCustomerById", filter: { id: this.users.id }, })`

my user model `class User extends Model { static entity = "users";

static fields() { return { id: this.attr(null), first_name: this.string(""), last_name: this.string(""), email: this.string(""), phone_number: this.string(""), profile: this.hasOne(Profile, "user_id"), contribution_plans: this.hasMany(ContributionPlan, "user_id") }; } } ` Please I'll really like to know if I'm doing something wrong, I've tested this with another custom query and the result is the same

timvandesteeg commented 3 years ago

Got exactly the same. Any ideas?

pich commented 3 years ago

The same here, but with $push() updated entity.

mycloudcodehub commented 3 years ago

Same issue, getting Couldn't find Type of name UserInput in the GraphQL Schema