backend cung da bi lac
This commit is contained in:
@@ -23,9 +23,10 @@ import SimpleObjectPlugin from '@pothos/plugin-simple-objects'
|
||||
import { User } from '@prisma/client'
|
||||
import { getDatamodel } from '../types/pothos.generated'
|
||||
import { DateTime } from 'luxon'
|
||||
import { Kind } from 'graphql'
|
||||
import { Kind, ValueNode } from 'graphql'
|
||||
import { DateTimeUtils } from '../common/utils/datetime.utils'
|
||||
import { JsonValue } from '@prisma/client/runtime/library'
|
||||
import Delta from 'quill-delta'
|
||||
|
||||
export type SchemaContext =
|
||||
| {
|
||||
@@ -75,6 +76,10 @@ export interface SchemaBuilderOption {
|
||||
Input: number
|
||||
Output: number | bigint | string
|
||||
}
|
||||
Delta: {
|
||||
Input: Delta
|
||||
Output: Delta
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,11 +101,10 @@ export class Builder extends SchemaBuilder<SchemaBuilderOption> {
|
||||
],
|
||||
smartSubscriptions: {
|
||||
debounceDelay: 1000,
|
||||
...subscribeOptionsFromIterator((name, ctx) => {
|
||||
if (ctx.isSubscription) {
|
||||
return ctx.websocket.pubSub.asyncIterator(name)
|
||||
}
|
||||
return ctx.http.pubSub.asyncIterator(name)
|
||||
...subscribeOptionsFromIterator((name, context) => {
|
||||
return context.isSubscription
|
||||
? context.websocket.pubSub.asyncIterator(name)
|
||||
: context.http.pubSub.asyncIterator(name)
|
||||
}),
|
||||
},
|
||||
zod: {
|
||||
@@ -154,6 +158,12 @@ export class Builder extends SchemaBuilder<SchemaBuilderOption> {
|
||||
throw new Error('Invalid DateTime')
|
||||
},
|
||||
})
|
||||
this.scalarType('Delta', {
|
||||
serialize: (value) => value.toString(),
|
||||
parseValue: (value: unknown) => value as unknown as Delta,
|
||||
parseLiteral: (ast: ValueNode) => ast as unknown as Delta,
|
||||
})
|
||||
|
||||
this.addScalarType('Json', JSONObjectResolver)
|
||||
this.addScalarType('Upload', GraphQLUpload)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user