update gi cung duoc

This commit is contained in:
2024-11-22 16:04:53 +07:00
parent d8a3894aba
commit ccfe7bf1f1
8 changed files with 41 additions and 11 deletions

View File

@@ -41,6 +41,7 @@ services:
- OPENAI_MAX_RETRIES=10 - OPENAI_MAX_RETRIES=10
- PRISMA_MAX_RETRY=10 - PRISMA_MAX_RETRY=10
- REDIS_URL=redis://10.0.27.1:6379 - REDIS_URL=redis://10.0.27.1:6379
- REDIS_PUBSUB_URL=redis://10.0.27.1:6379/7
- LIVEKIT_API_KEY=APIxrJC8ckEXiKH - LIVEKIT_API_KEY=APIxrJC8ckEXiKH
- LIVEKIT_API_SECRET=vfVPEHkpe3VGQdNYiW2TfwagPONW4mlzf9JQu8YV13FA - LIVEKIT_API_SECRET=vfVPEHkpe3VGQdNYiW2TfwagPONW4mlzf9JQu8YV13FA
- LIVEKIT_PORT=29258 - LIVEKIT_PORT=29258

13
package-lock.json generated
View File

@@ -50,6 +50,7 @@
"class-validator": "^0.14.1", "class-validator": "^0.14.1",
"epess-web-backend": "file:", "epess-web-backend": "file:",
"graphql": "^16.9.0", "graphql": "^16.9.0",
"graphql-redis-subscriptions": "^2.6.1",
"graphql-scalars": "^1.23.0", "graphql-scalars": "^1.23.0",
"graphql-subscriptions": "^2.0.0", "graphql-subscriptions": "^2.0.0",
"graphql-tools": "^9.0.1", "graphql-tools": "^9.0.1",
@@ -10840,6 +10841,18 @@
"graphql": "^14.6.0 || ^15.0.0 || ^16.0.0" "graphql": "^14.6.0 || ^15.0.0 || ^16.0.0"
} }
}, },
"node_modules/graphql-redis-subscriptions": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/graphql-redis-subscriptions/-/graphql-redis-subscriptions-2.6.1.tgz",
"integrity": "sha512-ssTviFZFB4P7nvZEPpIsP0gvBMJe5IcgR80Mjit/UFUk0snbkxG/gtNZoglQGtN+kvDx8H6MfALBSG0bm11KCA==",
"license": "MIT",
"optionalDependencies": {
"ioredis": "^5.3.2"
},
"peerDependencies": {
"graphql-subscriptions": "^1.0.0 || ^2.0.0"
}
},
"node_modules/graphql-request": { "node_modules/graphql-request": {
"version": "6.1.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-6.1.0.tgz", "resolved": "https://registry.npmjs.org/graphql-request/-/graphql-request-6.1.0.tgz",

View File

@@ -72,6 +72,7 @@
"class-validator": "^0.14.1", "class-validator": "^0.14.1",
"epess-web-backend": "file:", "epess-web-backend": "file:",
"graphql": "^16.9.0", "graphql": "^16.9.0",
"graphql-redis-subscriptions": "^2.6.1",
"graphql-scalars": "^1.23.0", "graphql-scalars": "^1.23.0",
"graphql-subscriptions": "^2.0.0", "graphql-subscriptions": "^2.0.0",
"graphql-tools": "^9.0.1", "graphql-tools": "^9.0.1",

View File

@@ -1,5 +1,10 @@
import { Inject, Injectable } from '@nestjs/common' import { Inject, Injectable } from '@nestjs/common'
import { Pothos, PothosRef, PothosSchema, SchemaBuilderToken } from '@smatch-corp/nestjs-pothos' import {
Pothos,
PothosRef,
PothosSchema,
SchemaBuilderToken,
} from '@smatch-corp/nestjs-pothos'
import { Builder } from '../Graphql/graphql.builder' import { Builder } from '../Graphql/graphql.builder'
import { PrismaService } from '../Prisma/prisma.service' import { PrismaService } from '../Prisma/prisma.service'
import { ChatRoomType } from '@prisma/client' import { ChatRoomType } from '@prisma/client'
@@ -57,6 +62,9 @@ export class ChatroomSchema extends PothosSchema {
type: 'DateTime', type: 'DateTime',
description: 'The last activity date and time.', description: 'The last activity date and time.',
}), }),
order: t.relation('Order', {
description: 'The order.',
}),
}), }),
}) })
} }
@@ -78,7 +86,8 @@ export class ChatroomSchema extends PothosSchema {
chatRooms: t.prismaField({ chatRooms: t.prismaField({
type: [this.chatRoom()], type: [this.chatRoom()],
description: 'Retrieve a list of chat rooms with optional filtering, ordering, and pagination.', description:
'Retrieve a list of chat rooms with optional filtering, ordering, and pagination.',
args: this.builder.generator.findManyArgs('ChatRoom'), args: this.builder.generator.findManyArgs('ChatRoom'),
resolve: async (query, _root, args, _ctx, _info) => { resolve: async (query, _root, args, _ctx, _info) => {
return await this.prisma.chatRoom.findMany({ return await this.prisma.chatRoom.findMany({

View File

@@ -39,7 +39,7 @@ import { WorkshopModule } from '../Workshop/workshop.module'
import { WorkshopOrganizationModule } from '../WorkshopOrganization/workshoporganization.module' import { WorkshopOrganizationModule } from '../WorkshopOrganization/workshoporganization.module'
import { WorkshopSubscriptionModule } from '../WorkshopSubscription/workshopsubscription.module' import { WorkshopSubscriptionModule } from '../WorkshopSubscription/workshopsubscription.module'
import { initContextCache } from '@pothos/core' import { initContextCache } from '@pothos/core'
import { PubSub } from 'graphql-subscriptions' import { RedisPubSub } from 'graphql-redis-subscriptions'
import { DocumentModule } from 'src/Document/document.module' import { DocumentModule } from 'src/Document/document.module'
import { Context } from 'graphql-ws' import { Context } from 'graphql-ws'
import { FinanceModule } from 'src/Finance/finance.module' import { FinanceModule } from 'src/Finance/finance.module'
@@ -88,7 +88,10 @@ import { FinanceModule } from 'src/Finance/finance.module'
GraphQLModule.forRootAsync<ApolloDriverConfig>({ GraphQLModule.forRootAsync<ApolloDriverConfig>({
driver: PothosApolloDriver, driver: PothosApolloDriver,
inject: [GraphqlService, 'PUB_SUB'], inject: [GraphqlService, 'PUB_SUB'],
useFactory: async (graphqlService: GraphqlService, pubsub: PubSub) => ({ useFactory: async (
graphqlService: GraphqlService,
pubsub: RedisPubSub,
) => ({
path: process.env.API_PATH + '/graphql', path: process.env.API_PATH + '/graphql',
debug: process.env.NODE_ENV === 'development' || false, debug: process.env.NODE_ENV === 'development' || false,
playground: process.env.NODE_ENV === 'development' || false, playground: process.env.NODE_ENV === 'development' || false,
@@ -178,7 +181,11 @@ import { FinanceModule } from 'src/Finance/finance.module'
}, },
{ {
provide: 'PUB_SUB', provide: 'PUB_SUB',
useFactory: () => new PubSub(), useFactory: () =>
new RedisPubSub({
connection:
process.env.REDIS_PUBSUB_URL ?? 'redis://10.0.27.1:6379/7',
}),
}, },
], ],
exports: [ exports: [

View File

@@ -394,7 +394,6 @@ export class UserSchema extends PothosSchema {
firstName: args.firstName as string, firstName: args.firstName as string,
lastName: args.lastName as string, lastName: args.lastName as string,
}) })
Logger.log(clerkUser, 'Clerk User')
// update bank account number and bank bin to database // update bank account number and bank bin to database
if (args.input?.bankAccountNumber) { if (args.input?.bankAccountNumber) {
await this.prisma.user.update({ await this.prisma.user.update({

File diff suppressed because one or more lines are too long