update commission
This commit is contained in:
Submodule epess-database updated: 31999e9454...43ddf9328e
@@ -43,4 +43,10 @@ export const ConfigConstants: Record<
|
|||||||
value: '22:00:00',
|
value: '22:00:00',
|
||||||
visible: true,
|
visible: true,
|
||||||
},
|
},
|
||||||
|
DEFAULT_COMMISSION: {
|
||||||
|
name: 'Default Commission',
|
||||||
|
key: 'DEFAULT_COMMISSION',
|
||||||
|
value: '0.05',
|
||||||
|
visible: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ export class ChatroomSchema extends PothosSchema {
|
|||||||
mentor: t.relation('mentor', {
|
mentor: t.relation('mentor', {
|
||||||
description: 'The mentor.',
|
description: 'The mentor.',
|
||||||
}),
|
}),
|
||||||
meetingRoom: t.relation('meetingRoom', {
|
collaborationSession: t.relation('CollaborationSession', {
|
||||||
description: 'The meeting room.',
|
description: 'The collaboration session.',
|
||||||
}),
|
}),
|
||||||
lastActivity: t.expose('lastActivity', {
|
lastActivity: t.expose('lastActivity', {
|
||||||
type: 'DateTime',
|
type: 'DateTime',
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ export enum DocumentEvent {
|
|||||||
SAVED = 'document_saved',
|
SAVED = 'document_saved',
|
||||||
PAGE_CREATED = 'document_page_created',
|
PAGE_CREATED = 'document_page_created',
|
||||||
PAGE_DELETED = 'document_page_deleted',
|
PAGE_DELETED = 'document_page_deleted',
|
||||||
|
DOCUMENT_CREATED = 'document_created',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import { Inject, Injectable, Logger } from '@nestjs/common'
|
import { Inject, Injectable, Logger } from '@nestjs/common'
|
||||||
import {
|
import { Pothos, PothosRef, PothosSchema, SchemaBuilderToken } from '@smatch-corp/nestjs-pothos'
|
||||||
Pothos,
|
|
||||||
PothosRef,
|
|
||||||
PothosSchema,
|
|
||||||
SchemaBuilderToken,
|
|
||||||
} from '@smatch-corp/nestjs-pothos'
|
|
||||||
import { Builder, SchemaContext } from '../Graphql/graphql.builder'
|
import { Builder, SchemaContext } from '../Graphql/graphql.builder'
|
||||||
import { PrismaService } from '../Prisma/prisma.service'
|
import { PrismaService } from '../Prisma/prisma.service'
|
||||||
import { DocumentEvent } from './document.event'
|
import { DocumentEvent } from './document.event'
|
||||||
@@ -33,22 +28,44 @@ export class DocumentSchema extends PothosSchema {
|
|||||||
updatedAt: t.expose('updatedAt', { type: 'DateTime' }),
|
updatedAt: t.expose('updatedAt', { type: 'DateTime' }),
|
||||||
owner: t.relation('owner'),
|
owner: t.relation('owner'),
|
||||||
ownerId: t.exposeID('ownerId'),
|
ownerId: t.exposeID('ownerId'),
|
||||||
collaborators: t.exposeStringList('collaborators'),
|
collaborators: t.relation('collaborators'),
|
||||||
isPublic: t.exposeBoolean('isPublic'),
|
isPublic: t.exposeBoolean('isPublic'),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PothosRef()
|
||||||
|
documentCollaborator() {
|
||||||
|
return this.builder.prismaObject('DocumentCollaborator', {
|
||||||
|
fields: (t) => ({
|
||||||
|
documentId: t.exposeID('documentId', { nullable: false }),
|
||||||
|
userId: t.exposeID('userId', { nullable: false }),
|
||||||
|
document: t.relation('document', { nullable: false }),
|
||||||
|
user: t.relation('user', { nullable: false }),
|
||||||
|
readable: t.exposeBoolean('readable', { nullable: false }),
|
||||||
|
writable: t.exposeBoolean('writable', { nullable: false }),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
@PothosRef()
|
@PothosRef()
|
||||||
documentDelta() {
|
documentDelta() {
|
||||||
return this.builder.simpleObject('DocumentDelta', {
|
return this.builder.simpleObject('DocumentDelta', {
|
||||||
fields: (t) => ({
|
fields: (t) => ({
|
||||||
documentId: t.string(),
|
eventType: t.string(),
|
||||||
pageIndex: t.int(),
|
documentId: t.string({
|
||||||
|
nullable: true,
|
||||||
|
}),
|
||||||
|
pageIndex: t.int({
|
||||||
|
nullable: true,
|
||||||
|
}),
|
||||||
delta: t.field({
|
delta: t.field({
|
||||||
type: 'Delta',
|
type: 'Delta',
|
||||||
|
nullable: true,
|
||||||
|
}),
|
||||||
|
senderId: t.string({
|
||||||
|
nullable: true,
|
||||||
}),
|
}),
|
||||||
senderId: t.string(),
|
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -98,11 +115,7 @@ export class DocumentSchema extends PothosSchema {
|
|||||||
if (ctx.isSubscription) throw new Error('Not allowed')
|
if (ctx.isSubscription) throw new Error('Not allowed')
|
||||||
const userId = ctx.http?.me?.id
|
const userId = ctx.http?.me?.id
|
||||||
if (!userId) throw new Error('User not found')
|
if (!userId) throw new Error('User not found')
|
||||||
const fileUrl = await this.minio.getFileUrl(
|
const fileUrl = await this.minio.getFileUrl('document', 'document', 'document')
|
||||||
'document',
|
|
||||||
'document',
|
|
||||||
'document',
|
|
||||||
)
|
|
||||||
if (!fileUrl) throw new Error('File not found')
|
if (!fileUrl) throw new Error('File not found')
|
||||||
const document = await this.prisma.document.create({
|
const document = await this.prisma.document.create({
|
||||||
...query,
|
...query,
|
||||||
@@ -155,10 +168,7 @@ export class DocumentSchema extends PothosSchema {
|
|||||||
delta,
|
delta,
|
||||||
senderId: ctx.http?.me?.id,
|
senderId: ctx.http?.me?.id,
|
||||||
}
|
}
|
||||||
ctx.http.pubSub.publish(
|
ctx.http.pubSub.publish(`${DocumentEvent.CHANGED}.${args.documentId}`, documentDelta)
|
||||||
`${DocumentEvent.CHANGED}.${args.documentId}`,
|
|
||||||
documentDelta,
|
|
||||||
)
|
|
||||||
return documentDelta
|
return documentDelta
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@@ -185,6 +195,32 @@ export class DocumentSchema extends PothosSchema {
|
|||||||
return args.data
|
return args.data
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
addCollaborator: t.prismaField({
|
||||||
|
type: this.documentCollaborator(),
|
||||||
|
args: {
|
||||||
|
documentId: t.arg({ type: 'String', required: true }),
|
||||||
|
userId: t.arg({ type: 'String', required: true }),
|
||||||
|
readable: t.arg({ type: 'Boolean', required: true }),
|
||||||
|
writable: t.arg({ type: 'Boolean', required: true }),
|
||||||
|
},
|
||||||
|
resolve: async (_, __, args, ctx: SchemaContext) => {
|
||||||
|
if (ctx.isSubscription) throw new Error('Not allowed')
|
||||||
|
// check if ctx user is owner of document
|
||||||
|
const document = await this.prisma.document.findUnique({
|
||||||
|
where: { id: args.documentId },
|
||||||
|
})
|
||||||
|
if (!document) throw new Error('Document not found')
|
||||||
|
if (document.ownerId !== ctx.http?.me?.id) throw new Error('User is not owner of document')
|
||||||
|
return await this.prisma.documentCollaborator.create({
|
||||||
|
data: {
|
||||||
|
documentId: args.documentId,
|
||||||
|
userId: args.userId,
|
||||||
|
readable: args.readable,
|
||||||
|
writable: args.writable,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
this.builder.subscriptionFields((t) => ({
|
this.builder.subscriptionFields((t) => ({
|
||||||
|
|||||||
@@ -1,5 +1,45 @@
|
|||||||
import { Injectable } from '@nestjs/common'
|
import { Inject, Injectable } from '@nestjs/common'
|
||||||
import { Pothos, PothosRef } from '@smatch-corp/nestjs-pothos'
|
import { Pothos, PothosRef, PothosSchema, SchemaBuilderToken } from '@smatch-corp/nestjs-pothos'
|
||||||
|
import { Builder } from 'src/Graphql/graphql.builder'
|
||||||
|
import { PrismaService } from 'src/Prisma/prisma.service'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FinanceSchema {}
|
export class FinanceSchema extends PothosSchema {
|
||||||
|
constructor(
|
||||||
|
@Inject(SchemaBuilderToken) private readonly builder: Builder,
|
||||||
|
private readonly prisma: PrismaService,
|
||||||
|
) {
|
||||||
|
super()
|
||||||
|
}
|
||||||
|
|
||||||
|
@PothosRef()
|
||||||
|
finance() {
|
||||||
|
return this.builder.simpleObject('Finance', {
|
||||||
|
description: 'A finance in the system.',
|
||||||
|
fields: (t) => ({
|
||||||
|
id: t.string({
|
||||||
|
description: 'The ID of the finance.',
|
||||||
|
}),
|
||||||
|
amount: t.string({
|
||||||
|
description: 'The amount of the finance.',
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@PothosRef()
|
||||||
|
init(): void {
|
||||||
|
this.builder.queryFields((t) => ({
|
||||||
|
finance: t.field({
|
||||||
|
type: this.finance(),
|
||||||
|
description: 'Retrieve a single finance by its unique identifier.',
|
||||||
|
resolve: async () => {
|
||||||
|
return {
|
||||||
|
id: '1',
|
||||||
|
amount: '100',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import { initContextCache } from '@pothos/core'
|
|||||||
import { PubSub } from 'graphql-subscriptions'
|
import { PubSub } from 'graphql-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'
|
||||||
|
|
||||||
@Global()
|
@Global()
|
||||||
@Module({
|
@Module({
|
||||||
@@ -77,6 +78,7 @@ import { Context } from 'graphql-ws'
|
|||||||
WorkshopMeetingRoomModule,
|
WorkshopMeetingRoomModule,
|
||||||
AdminNoteModule,
|
AdminNoteModule,
|
||||||
DocumentModule,
|
DocumentModule,
|
||||||
|
FinanceModule,
|
||||||
PothosModule.forRoot({
|
PothosModule.forRoot({
|
||||||
builder: {
|
builder: {
|
||||||
inject: [PrismaService],
|
inject: [PrismaService],
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ export class OrderSchema extends PothosSchema {
|
|||||||
type: 'DateTime',
|
type: 'DateTime',
|
||||||
description: 'The date and time the order was updated.',
|
description: 'The date and time the order was updated.',
|
||||||
}),
|
}),
|
||||||
|
commission: t.exposeFloat('commission', {
|
||||||
|
description: 'The commission of the order.',
|
||||||
|
}),
|
||||||
user: t.relation('user', {
|
user: t.relation('user', {
|
||||||
description: 'The user who made the order.',
|
description: 'The user who made the order.',
|
||||||
}),
|
}),
|
||||||
@@ -107,7 +110,7 @@ export class OrderSchema extends PothosSchema {
|
|||||||
description: 'Create a new order.',
|
description: 'Create a new order.',
|
||||||
args: {
|
args: {
|
||||||
data: t.arg({
|
data: t.arg({
|
||||||
type: this.builder.generator.getCreateInput('Order', ['id', 'user', 'paymentId', 'payment', 'refundTicket', 'status', 'total', 'createdAt', 'updatedAt']),
|
type: this.builder.generator.getCreateInput('Order', ['id', 'user', 'paymentId', 'payment', 'refundTicket', 'status', 'total', 'createdAt', 'updatedAt', 'commission']),
|
||||||
required: true,
|
required: true,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@@ -146,6 +149,7 @@ export class OrderSchema extends PothosSchema {
|
|||||||
userId: ctx.http.me?.id ?? '',
|
userId: ctx.http.me?.id ?? '',
|
||||||
serviceId: service.id,
|
serviceId: service.id,
|
||||||
scheduleId: args.data.schedule.connect?.id ?? '',
|
scheduleId: args.data.schedule.connect?.id ?? '',
|
||||||
|
commission: service.commission ?? 0.0,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// check if service is valid
|
// check if service is valid
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import { Inject, Injectable, Logger } from '@nestjs/common'
|
import { Inject, Injectable, Logger } from '@nestjs/common'
|
||||||
import {
|
import { Pothos, PothosRef, PothosSchema, SchemaBuilderToken } from '@smatch-corp/nestjs-pothos'
|
||||||
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 { MinioService } from '../Minio/minio.service'
|
import { MinioService } from '../Minio/minio.service'
|
||||||
@@ -50,6 +45,18 @@ export class ServiceSchema extends PothosSchema {
|
|||||||
price: t.exposeFloat('price', {
|
price: t.exposeFloat('price', {
|
||||||
description: 'The price of the service.',
|
description: 'The price of the service.',
|
||||||
}),
|
}),
|
||||||
|
commission: t.exposeFloat('commission', {
|
||||||
|
description: 'The commission of the service.',
|
||||||
|
validate: (value) => {
|
||||||
|
if (value === undefined) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (typeof value !== 'number' || value < 0 || value > 1) {
|
||||||
|
throw new Error('Commission must be between 0 and 1, eg: 0.05 for 5%')
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
}),
|
||||||
rating: t.expose('rating', {
|
rating: t.expose('rating', {
|
||||||
type: 'Float',
|
type: 'Float',
|
||||||
nullable: true,
|
nullable: true,
|
||||||
@@ -67,15 +74,8 @@ export class ServiceSchema extends PothosSchema {
|
|||||||
description: 'The URL of the image file for the service.',
|
description: 'The URL of the image file for the service.',
|
||||||
resolve: async (service) => {
|
resolve: async (service) => {
|
||||||
// get file id from imageFileUrl
|
// get file id from imageFileUrl
|
||||||
const imageFileId = service.imageFileUrl
|
const imageFileId = service.imageFileUrl?.split('/').pop()?.split('?')[0]
|
||||||
?.split('/')
|
return await this.minioService.updatePresignUrl(imageFileId ?? '', 'files', service.imageFileUrl ?? undefined)
|
||||||
.pop()
|
|
||||||
?.split('?')[0]
|
|
||||||
return await this.minioService.updatePresignUrl(
|
|
||||||
imageFileId ?? '',
|
|
||||||
'files',
|
|
||||||
service.imageFileUrl ?? undefined,
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
status: t.expose('status', {
|
status: t.expose('status', {
|
||||||
@@ -147,8 +147,7 @@ export class ServiceSchema extends PothosSchema {
|
|||||||
{},
|
{},
|
||||||
),
|
),
|
||||||
services: t.prismaField({
|
services: t.prismaField({
|
||||||
description:
|
description: 'Retrieve a list of services with optional filtering, ordering, and pagination.',
|
||||||
'Retrieve a list of services with optional filtering, ordering, and pagination.',
|
|
||||||
type: [this.service()],
|
type: [this.service()],
|
||||||
args: this.builder.generator.findManyArgs('Service'),
|
args: this.builder.generator.findManyArgs('Service'),
|
||||||
resolve: async (query, _root, args, _ctx, _info) => {
|
resolve: async (query, _root, args, _ctx, _info) => {
|
||||||
@@ -163,8 +162,7 @@ export class ServiceSchema extends PothosSchema {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
servicesByCenter: t.prismaField({
|
servicesByCenter: t.prismaField({
|
||||||
description:
|
description: 'Retrieve a list of services with optional filtering, ordering, and pagination.',
|
||||||
'Retrieve a list of services with optional filtering, ordering, and pagination.',
|
|
||||||
type: [this.service()],
|
type: [this.service()],
|
||||||
|
|
||||||
args: this.builder.generator.findManyArgs('Service'),
|
args: this.builder.generator.findManyArgs('Service'),
|
||||||
@@ -329,9 +327,7 @@ export class ServiceSchema extends PothosSchema {
|
|||||||
...query,
|
...query,
|
||||||
where: { id: args.serviceId },
|
where: { id: args.serviceId },
|
||||||
data: {
|
data: {
|
||||||
status: args.approve
|
status: args.approve ? ServiceStatus.APPROVED : ServiceStatus.REJECTED,
|
||||||
? ServiceStatus.APPROVED
|
|
||||||
: ServiceStatus.REJECTED,
|
|
||||||
adminNote: {
|
adminNote: {
|
||||||
create: {
|
create: {
|
||||||
content: args.adminNote ?? '',
|
content: args.adminNote ?? '',
|
||||||
@@ -362,31 +358,18 @@ export class ServiceSchema extends PothosSchema {
|
|||||||
where: { id: { in: mentorIds } },
|
where: { id: { in: mentorIds } },
|
||||||
})
|
})
|
||||||
Logger.log(mentorEmails, 'ServiceSchema')
|
Logger.log(mentorEmails, 'ServiceSchema')
|
||||||
const emails = [
|
const emails = [centerOwner.email, ...mentorEmails.map((mentor) => mentor.email)]
|
||||||
centerOwner.email,
|
|
||||||
...mentorEmails.map((mentor) => mentor.email),
|
|
||||||
]
|
|
||||||
if (args.approve) {
|
if (args.approve) {
|
||||||
await this.mailService.sendTemplateEmail(
|
await this.mailService.sendTemplateEmail(emails, 'Thông báo về trạng thái dịch vụ', 'ServiceApproved', {
|
||||||
emails,
|
SERVICE_NAME: service.name,
|
||||||
'Thông báo về trạng thái dịch vụ',
|
CENTER_NAME: center.name,
|
||||||
'ServiceApproved',
|
})
|
||||||
{
|
|
||||||
SERVICE_NAME: service.name,
|
|
||||||
CENTER_NAME: center.name,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
await this.mailService.sendTemplateEmail(
|
await this.mailService.sendTemplateEmail(emails, 'Thông báo về trạng thái dịch vụ', 'ServiceRejected', {
|
||||||
emails,
|
SERVICE_NAME: service.name,
|
||||||
'Thông báo về trạng thái dịch vụ',
|
CENTER_NAME: center.name,
|
||||||
'ServiceRejected',
|
ADMIN_NOTE: args.adminNote ?? 'Không có lý do',
|
||||||
{
|
})
|
||||||
SERVICE_NAME: service.name,
|
|
||||||
CENTER_NAME: center.name,
|
|
||||||
ADMIN_NOTE: args.adminNote ?? 'Không có lý do',
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
return updatedService
|
return updatedService
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
import { Inject, Injectable } from '@nestjs/common'
|
import { Inject, Injectable } from '@nestjs/common'
|
||||||
import {
|
import { Pothos, PothosRef, PothosSchema, SchemaBuilderToken } from '@smatch-corp/nestjs-pothos'
|
||||||
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 { LiveKitRoomService } from 'src/LiveKit/livekit.room.service'
|
// import { LiveKitRoomService } from 'src/LiveKit/livekit.room.service'
|
||||||
@@ -22,17 +17,17 @@ export class ServiceMeetingRoomSchema extends PothosSchema {
|
|||||||
|
|
||||||
@PothosRef()
|
@PothosRef()
|
||||||
serviceMeetingRoom() {
|
serviceMeetingRoom() {
|
||||||
return this.builder.prismaObject('ServiceMeetingRoom', {
|
return this.builder.prismaObject('CollaborationSession', {
|
||||||
description: 'A service meeting room in the system.',
|
description: 'A service meeting room in the system.',
|
||||||
fields: (t) => ({
|
fields: (t) => ({
|
||||||
id: t.exposeID('id', {
|
id: t.exposeID('id', {
|
||||||
description: 'The ID of the service meeting room.',
|
description: 'The ID of the collaboration session.',
|
||||||
}),
|
}),
|
||||||
chattingRoomId: t.exposeString('chattingRoomId', {
|
chatRoomId: t.exposeString('chatRoomId', {
|
||||||
description: 'The ID of the chatting room.',
|
description: 'The ID of the chat room.',
|
||||||
}),
|
}),
|
||||||
chattingRoom: t.relation('chattingRoom', {
|
chatRoom: t.relation('chatRoom', {
|
||||||
description: 'The chatting room.',
|
description: 'The chat room.',
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
@@ -43,11 +38,10 @@ export class ServiceMeetingRoomSchema extends PothosSchema {
|
|||||||
this.builder.queryFields((t) => ({
|
this.builder.queryFields((t) => ({
|
||||||
serviceMeetingRoom: t.prismaField({
|
serviceMeetingRoom: t.prismaField({
|
||||||
type: this.serviceMeetingRoom(),
|
type: this.serviceMeetingRoom(),
|
||||||
args: this.builder.generator.findUniqueArgs('ServiceMeetingRoom'),
|
args: this.builder.generator.findUniqueArgs('CollaborationSession'),
|
||||||
description:
|
description: 'Retrieve a single collaboration session by its unique identifier.',
|
||||||
'Retrieve a single service meeting room by its unique identifier.',
|
|
||||||
resolve: async (query, _root, args, _ctx, _info) => {
|
resolve: async (query, _root, args, _ctx, _info) => {
|
||||||
return await this.prisma.serviceMeetingRoom.findUnique({
|
return await this.prisma.collaborationSession.findUnique({
|
||||||
...query,
|
...query,
|
||||||
where: args.where,
|
where: args.where,
|
||||||
})
|
})
|
||||||
@@ -55,11 +49,10 @@ export class ServiceMeetingRoomSchema extends PothosSchema {
|
|||||||
}),
|
}),
|
||||||
serviceMeetingRooms: t.prismaField({
|
serviceMeetingRooms: t.prismaField({
|
||||||
type: [this.serviceMeetingRoom()],
|
type: [this.serviceMeetingRoom()],
|
||||||
args: this.builder.generator.findManyArgs('ServiceMeetingRoom'),
|
args: this.builder.generator.findManyArgs('CollaborationSession'),
|
||||||
description:
|
description: 'Retrieve a list of collaboration sessions with optional filtering, ordering, and pagination.',
|
||||||
'Retrieve a list of service meeting rooms with optional filtering, ordering, and pagination.',
|
|
||||||
resolve: async (query, _root, args, _ctx, _info) => {
|
resolve: async (query, _root, args, _ctx, _info) => {
|
||||||
return await this.prisma.serviceMeetingRoom.findMany({
|
return await this.prisma.collaborationSession.findMany({
|
||||||
...query,
|
...query,
|
||||||
skip: args.skip ?? undefined,
|
skip: args.skip ?? undefined,
|
||||||
take: args.take ?? undefined,
|
take: args.take ?? undefined,
|
||||||
@@ -75,22 +68,22 @@ export class ServiceMeetingRoomSchema extends PothosSchema {
|
|||||||
type: this.serviceMeetingRoom(),
|
type: this.serviceMeetingRoom(),
|
||||||
args: {
|
args: {
|
||||||
input: t.arg({
|
input: t.arg({
|
||||||
type: this.builder.generator.getCreateInput('ServiceMeetingRoom'),
|
type: this.builder.generator.getCreateInput('CollaborationSession'),
|
||||||
required: true,
|
required: true,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
description: 'Create a new service meeting room.',
|
description: 'Create a new service meeting room.',
|
||||||
resolve: async (query, _root, args, _ctx, _info) => {
|
resolve: async (query, _root, args, _ctx, _info) => {
|
||||||
// for test only !!!
|
// for test only !!!
|
||||||
if (args.input.chattingRoom.create) {
|
if (args.input.chatRoom.create) {
|
||||||
args.input.chattingRoom.create.id = uuidv4()
|
args.input.chatRoom.create.id = uuidv4()
|
||||||
}
|
}
|
||||||
|
|
||||||
// call livekit room service to create room
|
// call livekit room service to create room
|
||||||
// this.liveKitRoomService.createServiceMeetingRoom(
|
// this.liveKitRoomService.createServiceMeetingRoom(
|
||||||
// args.input.chattingRoom.create?.id ?? '',
|
// args.input.chatRoom.create?.id ?? '',
|
||||||
// )
|
// )
|
||||||
return await this.prisma.serviceMeetingRoom.create({
|
return await this.prisma.collaborationSession.create({
|
||||||
...query,
|
...query,
|
||||||
data: args.input,
|
data: args.input,
|
||||||
})
|
})
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user