refactor: update getRoomRecordUrl method in MinioService for improved promise handling

- Changed the implementation of the `getRoomRecordUrl` method to use `await` with the Promise constructor for better readability and consistency.
- This adjustment enhances the asynchronous handling of the method, ensuring a more straightforward promise resolution process.
This commit is contained in:
2024-12-05 21:14:00 +07:00
parent 10df93d534
commit 0d973a6544

View File

@@ -139,7 +139,7 @@ export class MinioService {
} }
// get the record url from minio by searching for the file starting with roomId and ending with .mp4 and returning the presigned url // get the record url from minio by searching for the file starting with roomId and ending with .mp4 and returning the presigned url
async getRoomRecordUrl(roomId: string) { async getRoomRecordUrl(roomId: string) {
return new Promise<string | null>(async (resolve, reject) => { return await new Promise<string | null>(async (resolve, reject) => {
const stream = this.minioClient.listObjects(this.configService.get('BUCKET_NAME') ?? 'epess', `records/${roomId}`, true) const stream = this.minioClient.listObjects(this.configService.get('BUCKET_NAME') ?? 'epess', `records/${roomId}`, true)
const items: BucketItem[] = [] const items: BucketItem[] = []