feat: integrate LiveKit services into Collaboration and Meeting Room modules

- Added LiveKitModule to CollaborationSession and MeetingRoom modules for enhanced real-time collaboration features.
- Updated CollaborationSessionSchema to include LiveKit services for managing participant access and room permissions.
- Implemented a new cron job in CronService to disable services without schedules for over 30 days, improving service management.
- Enhanced GraphQL schema generation with improved filtering logic for better performance and readability.
- Refactored LiveKit services to streamline access token creation and room management functionalities.
This commit is contained in:
2024-12-01 19:18:20 +07:00
parent 111acacf2d
commit 561823225d
10 changed files with 206 additions and 96 deletions

View File

@@ -1,13 +1,7 @@
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, SchemaContext } from 'src/Graphql/graphql.builder'
import { PrismaService } from 'src/Prisma/prisma.service'
@Injectable()
export class MeetingRoomSchema extends PothosSchema {
constructor(
@@ -56,14 +50,12 @@ export class MeetingRoomSchema extends PothosSchema {
},
resolve: async (_query, _parent, args, ctx: SchemaContext) => {
if (ctx.isSubscription) throw new Error('Not allowed')
const collaborationSession =
await this.prisma.collaborationSession.findUnique({
where: {
scheduleDateId: args.scheduleDateId,
},
})
if (!collaborationSession)
throw new Error('Collaboration session not found')
const collaborationSession = await this.prisma.collaborationSession.findUnique({
where: {
scheduleDateId: args.scheduleDateId,
},
})
if (!collaborationSession) throw new Error('Collaboration session not found')
const meetingRoom = await this.prisma.meetingRoom.findUnique({
where: {
collaborationSessionId: collaborationSession.id,
@@ -83,7 +75,12 @@ export class MeetingRoomSchema extends PothosSchema {
type: this.meetingRoom(),
args: {
input: t.arg({
type: this.builder.generator.getCreateInput('MeetingRoom'),
type: this.builder.generator.getCreateInput('MeetingRoom', [
'id',
'createdAt',
'updatedAt',
'collaborators',
]),
required: true,
}),
},