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:
2024-11-28 20:09:37 +07:00
parent e546c348cc
commit abb7e38df3
3 changed files with 29 additions and 42 deletions

View File

@@ -198,7 +198,7 @@ export class DocumentSchema extends PothosSchema {
if (ctx.isSubscription) throw new Error('Not allowed')
const userId = ctx.http?.me?.id
if (!userId) throw new Error('User not found')
return await this.prisma.document.create({
const document = await this.prisma.document.create({
...query,
data: {
...args.input,
@@ -211,6 +211,9 @@ export class DocumentSchema extends PothosSchema {
},
},
})
// create document in minio
await this.minio.createDocumentFolder(document.id)
return document
},
}),