grats
grats copied to clipboard
Add the ability to define fields using static methods just like exported functions
trafficstars
Would require that the class be exported, but would enable grouping top level query/mutation fields in models:
/** @gqlType */
class User {
/** @gqlField */
name: string;
/** @gqlField */
static getUser(_: Query, args: {id: ID}): User {
return new User { name: "Jordan" };
}
/** @gqlField */
static deleteUser(_: Mutation, args: {id: ID}): bolean {
// TODO: Delete user
return true;
}
}