push code push code
This commit is contained in:
@@ -21,6 +21,7 @@ export class UserSchema extends PothosSchema {
|
||||
@PothosRef()
|
||||
user() {
|
||||
return this.builder.prismaObject('User', {
|
||||
description: 'A user in the system.',
|
||||
fields: (t) => ({
|
||||
id: t.exposeID('id'),
|
||||
name: t.exposeString('name'),
|
||||
@@ -40,6 +41,8 @@ export class UserSchema extends PothosSchema {
|
||||
init(): void {
|
||||
this.builder.queryFields((t) => ({
|
||||
users: t.prismaField({
|
||||
description:
|
||||
'Retrieve a list of users with optional filtering, ordering, and pagination.',
|
||||
type: [this.user()],
|
||||
args: this.builder.generator.findManyArgs('User'),
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
@@ -54,6 +57,7 @@ export class UserSchema extends PothosSchema {
|
||||
}),
|
||||
|
||||
user: t.prismaField({
|
||||
description: 'Retrieve a single user by their unique identifier.',
|
||||
type: this.user(),
|
||||
args: this.builder.generator.findUniqueArgs('User'),
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
@@ -64,6 +68,7 @@ export class UserSchema extends PothosSchema {
|
||||
},
|
||||
}),
|
||||
userBySession: t.prismaField({
|
||||
description: 'Retrieve a single user by their session ID.',
|
||||
type: this.user(),
|
||||
args: {
|
||||
sessionId: t.arg({ type: 'String', required: true }),
|
||||
@@ -85,6 +90,7 @@ export class UserSchema extends PothosSchema {
|
||||
// Mutation section
|
||||
this.builder.mutationFields((t) => ({
|
||||
updateUser: t.prismaField({
|
||||
description: 'Update an existing user.',
|
||||
type: this.user(),
|
||||
args: {
|
||||
input: t.arg({
|
||||
|
||||
Reference in New Issue
Block a user