mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 00:38:11 +00:00
implement file module and add files relation to booking entity and populate on fetch
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Inject, Injectable, Logger } from "@nestjs/common";
|
||||
import { ConfigType } from "@nestjs/config";
|
||||
import { Client } from "minio";
|
||||
import { Readable } from "stream";
|
||||
import { minioConfig } from "./minio.config";
|
||||
|
||||
@Injectable()
|
||||
@@ -62,4 +63,13 @@ export class MinioService {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async getFileStream(objectName: string): Promise<Readable> {
|
||||
try {
|
||||
return this.client.getObject(this.bucket, objectName);
|
||||
} catch (error) {
|
||||
this.logger.error(`Failed to get file ${objectName}:`, error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user