implement file module and add files relation to booking entity and populate on fetch

This commit is contained in:
marshal
2026-05-25 10:19:08 +03:00
parent ae317540c1
commit 9432814e3b
12 changed files with 245 additions and 44 deletions

View File

@@ -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;
}
}
}