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,36 +1,35 @@
// import {
// Room,
// RoomServiceClient,
// RoomCompositeOptions,
// // @ts-ignore
// } from 'livekit-server-sdk'
// import { v4 as uuidv4 } from 'uuid'
import { v4 as uuidv4 } from 'uuid'
// export class LiveKitRoomService {
// private roomServiceClient: RoomServiceClient
export class LiveKitRoomService {
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
private roomServiceClient: any
constructor() {
this.initializeRoomServiceClient()
}
// constructor() {
// this.roomServiceClient = new RoomServiceClient(
// process.env.LIVEKIT_URL as string,
// process.env.LIVEKIT_API_KEY as string,
// process.env.LIVEKIT_API_SECRET as string,
// )
// }
private async initializeRoomServiceClient() {
const { RoomServiceClient } = await import('livekit-server-sdk')
this.roomServiceClient = new RoomServiceClient(
process.env.LIVEKIT_URL as string,
process.env.LIVEKIT_API_KEY as string,
process.env.LIVEKIT_API_SECRET as string,
)
}
// async createServiceMeetingRoom(chattingRoomId: string) {
// const room = await this.roomServiceClient.createRoom({
// maxParticipants: 3,
// name: chattingRoomId,
// })
async createServiceMeetingRoom(chattingRoomId: string) {
const room = await this.roomServiceClient.createRoom({
maxParticipants: 3,
name: chattingRoomId,
})
// return room
// }
return room
}
// async createWorkshopMeetingRoom(workshopId: string, maxParticipants: number) {
// const room = await this.roomServiceClient.createRoom({
// maxParticipants: maxParticipants,
// name: workshopId,
// })
// return room
// }
// }
async createWorkshopMeetingRoom(workshopId: string, maxParticipants: number) {
const room = await this.roomServiceClient.createRoom({
maxParticipants: maxParticipants,
name: workshopId,
})
return room
}
}