Enhance DocumentSchema and MinioService to support document folder creation. Update document creation logic to include folder setup in Minio after document creation. Refactor createDocumentFolder method to initialize a default page in the document folder. This improves document management and organization within the Minio storage system.
This commit is contained in:
@@ -81,9 +81,15 @@ export class MinioService {
|
||||
async deleteFile(id: string, category: string) {
|
||||
return await this.minioClient.removeObject(this.configService.get('BUCKET_NAME') ?? 'epess', `${category}/${id}`)
|
||||
}
|
||||
// create a folder for a document pattern epess/documents/<id>/<page>
|
||||
// create a folder for a document pattern epess/documents/<id>/<page> and add page 0 to default
|
||||
async createDocumentFolder(id: string) {
|
||||
return await this.minioClient.putObject(this.configService.get('BUCKET_NAME') ?? 'epess', `documents/${id}`, '')
|
||||
const emptyDelta = JSON.stringify(new Delta().insert('\n'))
|
||||
const result = await this.minioClient.putObject(
|
||||
this.configService.get('BUCKET_NAME') ?? 'epess',
|
||||
`documents/${id}/0`,
|
||||
emptyDelta,
|
||||
)
|
||||
return result
|
||||
}
|
||||
|
||||
async upsertDocumentPage(id: string, page: number, delta: Delta) {
|
||||
|
||||
Reference in New Issue
Block a user