menu

accounts-js

Fullstack authentication and accounts-management for Javascript

Channels
Team

#UserAsInterface. How can I implement this functionality ?

October 2, 2020 at 5:35pm

#UserAsInterface. How can I implement this functionality ?

October 2, 2020 at 5:35pm
I am trying of implement but I get errors like:
"message": "Abstract type \"User\" must resolve to an Object type at runtime for field \"Query.getUser\" with value { _id: { _bsontype: \"ObjectID\", id: <Buffer 5f 77 58 a6 23 01 2f 11 dc da a2 67> }, store: { name: \"TUF DESDE\", description: \"MITIENDA\" }, accountType: \"Admin\", createdAt: 1601656998977, updatedAt: 1601656998977, username: \"TUFa\", emails: [[Object]], id: \"5f7758a623012f11dcdaa267\" }, received \"undefined\". Either the \"User\" type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function.",
Can you help Me with a example or some similar ?

October 6, 2020 at 8:12am
Can you paste your schema please?
like-fill
1
  • reply
  • like

October 6, 2020 at 4:12pm
import { gql } from "apollo-server-express";
export const userSchemaExtend = gql` extend type User { store: Store accountType: AccountType }
type Store { name: String description: String }
enum AccountType { Admin Seller }
type Admin { id: ID accountType: AccountType username: String emails: [EmailRecord] store: Store }
type Seller implements User { id: ID! accountType: AccountType username: String emails: [EmailRecord!] store: Store }
extend input CreateUserInput { store: CreateStoreInput! accountType: AccountType }
input CreateStoreInput { name: String! description: String! } `;
export const UserResolver = {
};
  • reply
  • like
is enabled userAsInterface: true friend ..
  • reply
  • like