update create note

This commit is contained in:
2024-10-28 16:23:58 +07:00
parent 155f68e264
commit 4d0a6136d6
2 changed files with 927 additions and 1336 deletions

View File

@@ -28,7 +28,7 @@ export class AdminNoteSchema extends PothosSchema {
content: t.exposeString('content', {
description: 'The content of the admin note.',
}),
notedByUserId: t.exposeString('notedByUserId', {
notedByUserId: t.exposeID('notedByUserId', {
description: 'The ID of the user who created the admin note.',
}),
notedBy: t.relation('notedBy', {
@@ -103,5 +103,24 @@ export class AdminNoteSchema extends PothosSchema {
},
}),
}));
// Mutations
this.builder.mutationFields((t) => ({
createAdminNote: t.prismaField({
type: this.adminNote(),
args: {
input: t.arg({
type: this.builder.generator.getCreateInput('AdminNote'),
required: true,
}),
},
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.adminNote.create({
...query,
data: args.input,
});
},
}),
}));
}
}