refactor and update get url logic
This commit is contained in:
@@ -39,7 +39,19 @@ export class UploadedFileSchema extends PothosSchema {
|
||||
nullable: false,
|
||||
description: 'The type of the file.',
|
||||
}),
|
||||
fileUrl: t.exposeString('fileUrl'),
|
||||
fileUrl: t.string({
|
||||
description: 'The URL of the file.',
|
||||
resolve: async (file, args, ctx) => {
|
||||
const fileUrl = await this.minioService.getFileUrl(
|
||||
file.fileName,
|
||||
'files',
|
||||
);
|
||||
if (!fileUrl) {
|
||||
throw new Error('Cannot retrieve file url');
|
||||
}
|
||||
return fileUrl;
|
||||
},
|
||||
}),
|
||||
uploadedAt: t.expose('uploadedAt', {
|
||||
type: 'DateTime',
|
||||
nullable: true,
|
||||
|
||||
Reference in New Issue
Block a user