Refactor DocumentSchema to remove fileUrl retrieval logic and set default value for fileUrl. This change simplifies the document creation process by eliminating unnecessary error handling related to file retrieval, while maintaining user ownership assignment.
This commit is contained in:
@@ -136,13 +136,13 @@ 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')
|
||||
const fileUrl = await this.minio.getFileUrl('document', 'document', 'document')
|
||||
if (!fileUrl) throw new Error('File not found')
|
||||
// const fileUrl = await this.minio.getFileUrl('document', 'document', 'document')
|
||||
// if (!fileUrl) throw new Error('File not found')
|
||||
const document = await this.prisma.document.create({
|
||||
...query,
|
||||
data: {
|
||||
name: 'Untitled',
|
||||
fileUrl,
|
||||
fileUrl: '', // fileUrl,
|
||||
ownerId: userId,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user