push code push code

This commit is contained in:
2024-10-17 15:02:25 +07:00
parent 053fb38273
commit 59923b02cb
18 changed files with 106 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ export class MessageSchema extends PothosSchema {
@PothosRef()
message() {
return this.builder.prismaObject('Message', {
description: 'A message in the system.',
fields: (t) => ({
id: t.exposeID('id'),
senderId: t.exposeID('senderId'),
@@ -38,6 +39,7 @@ export class MessageSchema extends PothosSchema {
this.builder.queryFields((t) => ({
message: t.prismaField({
type: this.message(),
description: 'Retrieve a single message by its unique identifier.',
args: this.builder.generator.findUniqueArgs('Message'),
resolve: async (query, root, args) => {
return await this.prisma.message.findUnique({
@@ -48,6 +50,8 @@ export class MessageSchema extends PothosSchema {
}),
messages: t.prismaField({
type: [this.message()],
description:
'Retrieve a list of messages with optional filtering, ordering, and pagination.',
args: this.builder.generator.findManyArgs('Message'),
resolve: async (query, root, args) => {
return await this.prisma.message.findMany({