Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to define fields using static methods just like exported functions #134

Open
captbaritone opened this issue Mar 22, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@captbaritone
Copy link
Owner

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;
  }
}
@captbaritone captbaritone added the enhancement New feature or request label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant