Skip to content

Commit

Permalink
Add mutation example
Browse files Browse the repository at this point in the history
  • Loading branch information
tgriesser authored Jul 13, 2021
1 parent 657f336 commit 079e64b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ class User {
return ctx.findUserByName();
}


@nxs.mutationField(() => ({
type: User,
args(t) {
t.nonNull.string('name')
}
}))
static async createUser(args, ctx) {
return new User(await ctx.db.insertUser(args))
}


@nxs.field.id()
get id() {
return `User:${this.record.id}`;
Expand Down

0 comments on commit 079e64b

Please sign in to comment.