refactor: update LiveKit integration and clean up unused services
- Changed the base image in Dockerfile to use a lighter node:alpine version. - Removed unused dependencies from package-lock.json and package.json, including @turbodocx/html-to-docx and jsdom. - Simplified LiveKit module by removing unnecessary services (LiveKitParticipantService, LiveKitRoomService) and adjusting related schemas and services for better maintainability. - Updated CollaborationSessionSchema to streamline access token creation and room management. - Commented out unused imports and services in various modules to enhance code clarity and reduce complexity.
This commit is contained in:
@@ -2,11 +2,10 @@ import { Module } from '@nestjs/common'
|
||||
import { CollaborationSessionSchema } from './collaborationsession.schema'
|
||||
import { LiveKitModule } from 'src/LiveKit/livekit.module'
|
||||
import { LiveKitService } from 'src/LiveKit/livekit.service'
|
||||
import { LiveKitParticipantService } from 'src/LiveKit/livekit.participant.service'
|
||||
import { LiveKitRoomService } from 'src/LiveKit/livekit.room.service'
|
||||
|
||||
@Module({
|
||||
imports: [LiveKitModule],
|
||||
providers: [CollaborationSessionSchema, LiveKitService, LiveKitParticipantService, LiveKitRoomService],
|
||||
providers: [CollaborationSessionSchema, LiveKitService],
|
||||
exports: [CollaborationSessionSchema],
|
||||
})
|
||||
export class CollaborationSessionModule {}
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
import { Inject, Injectable, Logger } from '@nestjs/common'
|
||||
import { Pothos, PothosRef, PothosSchema, SchemaBuilderToken } from '@smatch-corp/nestjs-pothos'
|
||||
import { Builder, SchemaContext } from '../Graphql/graphql.builder'
|
||||
import { PrismaService } from '../Prisma/prisma.service'
|
||||
// import { LiveKitRoomService } from 'src/LiveKit/livekit.room.service'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { CollaborationSession, Role, ScheduleDateStatus } from '@prisma/client'
|
||||
|
||||
import { Builder, SchemaContext } from 'src/Graphql/graphql.builder'
|
||||
import { PrismaService } from 'src/Prisma/prisma.service'
|
||||
import { DateTimeUtils } from 'src/common/utils/datetime.utils'
|
||||
import { LiveKitService } from 'src/LiveKit/livekit.service'
|
||||
import { LiveKitParticipantService } from 'src/LiveKit/livekit.participant.service'
|
||||
@Injectable()
|
||||
export class CollaborationSessionSchema extends PothosSchema {
|
||||
constructor(
|
||||
@Inject(SchemaBuilderToken) private readonly builder: Builder,
|
||||
private readonly prisma: PrismaService,
|
||||
private readonly liveKitService: LiveKitService,
|
||||
private readonly liveKitParticipantService: LiveKitParticipantService,
|
||||
) {
|
||||
super()
|
||||
}
|
||||
@@ -204,9 +201,8 @@ export class CollaborationSessionSchema extends PothosSchema {
|
||||
},
|
||||
})
|
||||
if (!meetingRoom) throw new Error('Meeting room not found')
|
||||
const token = await this.liveKitService.createAccessToken(ctx.http.me.id)
|
||||
await this.liveKitParticipantService.grantRoomJoinPermission(token, meetingRoom.collaborationSessionId)
|
||||
return await this.liveKitParticipantService.toJWT(token)
|
||||
const token = await this.liveKitService.createToken(ctx.http.me, meetingRoom.id)
|
||||
return token
|
||||
},
|
||||
}),
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user