update sth :)

This commit is contained in:
2024-11-26 17:55:34 +07:00
parent 8b01df2111
commit 1062f5944d
4 changed files with 52 additions and 25 deletions

View File

@@ -204,7 +204,7 @@ export class DocumentSchema extends PothosSchema {
},
}),
eventUpdateDocument: t.field({
eventDocumentChanged: t.field({
type: this.documentDelta(),
args: {
data: t.arg({
@@ -226,6 +226,23 @@ export class DocumentSchema extends PothosSchema {
return args.data
},
}),
eventDocumentRequestSync: t.field({
type: this.documentDelta(),
args: {
data: t.arg({
type: this.documentDeltaInput(),
required: true,
}),
},
resolve: async (_, args, ctx: SchemaContext) => {
if (ctx.isSubscription) throw new Error('Not allowed')
return {
...args.data,
senderId: ctx.http?.me?.id,
eventType: DocumentEvent.REQUEST_SYNC,
}
},
}),
updateDocument: t.prismaField({
type: this.document(),