feat: add record URL retrieval to MeetingRoom schema and enhance MinioService

- Introduced a new field `recordUrl` in the MeetingRoom schema to fetch the presigned URL for meeting room recordings.
- Implemented `getRoomRecordUrl` method in MinioService to retrieve the recording URL from Minio, enhancing the service's functionality.
- Updated imports in MeetingRoom schema to include MinioService for the new functionality.
This commit is contained in:
2024-12-05 21:10:45 +07:00
parent 62662b0256
commit 10df93d534
2 changed files with 27 additions and 5 deletions

View File

@@ -1,14 +1,16 @@
import { Inject, Injectable } from '@nestjs/common'
import { Inject, Injectable, Logger } from '@nestjs/common'
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'
import { LiveKitService } from 'src/LiveKit/livekit.service'
import { MinioService } from 'src/Minio/minio.service'
@Injectable()
export class MeetingRoomSchema extends PothosSchema {
constructor(
@Inject(SchemaBuilderToken) private readonly builder: Builder,
private readonly prisma: PrismaService,
private readonly livekitService: LiveKitService,
private readonly minioService: MinioService,
) {
super()
}
@@ -22,6 +24,12 @@ export class MeetingRoomSchema extends PothosSchema {
collaborators: t.relation('collaborators'),
createdAt: t.expose('createdAt', { type: 'DateTime' }),
updatedAt: t.expose('updatedAt', { type: 'DateTime' }),
recordUrl: t.string({
nullable: true,
resolve: async (meetingRoom) => {
return await this.minioService.getRoomRecordUrl(meetingRoom.id)
},
}),
}),
})
}