mirror of
https://github.com/hexastack/hexabot
synced 2025-01-22 10:35:37 +00:00
fix: apply review feedback
This commit is contained in:
parent
81aed2e5db
commit
6a4746dccd
@ -61,7 +61,7 @@ export class AttachmentService extends BaseService<Attachment> {
|
|||||||
const storageHelper = await this.helperService.getDefaultHelper(
|
const storageHelper = await this.helperService.getDefaultHelper(
|
||||||
HelperType.STORAGE,
|
HelperType.STORAGE,
|
||||||
);
|
);
|
||||||
return storageHelper.download(attachment);
|
return await storageHelper.download(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +74,7 @@ export class AttachmentService extends BaseService<Attachment> {
|
|||||||
const storageHelper = await this.helperService.getDefaultHelper(
|
const storageHelper = await this.helperService.getDefaultHelper(
|
||||||
HelperType.STORAGE,
|
HelperType.STORAGE,
|
||||||
);
|
);
|
||||||
return storageHelper.readAsBuffer(attachment);
|
return await storageHelper.readAsBuffer(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -775,20 +775,29 @@ const migrateAndPopulateAttachmentMessages = async ({
|
|||||||
const addDefaultStorageHelper = async ({ logger }: MigrationServices) => {
|
const addDefaultStorageHelper = async ({ logger }: MigrationServices) => {
|
||||||
const SettingModel = mongoose.model<Setting>(Setting.name, settingSchema);
|
const SettingModel = mongoose.model<Setting>(Setting.name, settingSchema);
|
||||||
try {
|
try {
|
||||||
await SettingModel.create({
|
await SettingModel.updateOne(
|
||||||
group: 'chatbot_settings',
|
{
|
||||||
label: 'default_storage_helper',
|
group: 'chatbot_settings',
|
||||||
value: 'local-storage-helper',
|
label: 'default_storage_helper',
|
||||||
type: SettingType.select,
|
|
||||||
config: {
|
|
||||||
multiple: false,
|
|
||||||
allowCreate: false,
|
|
||||||
entity: 'Helper',
|
|
||||||
idKey: 'name',
|
|
||||||
labelKey: 'name',
|
|
||||||
},
|
},
|
||||||
weight: 2,
|
{
|
||||||
});
|
group: 'chatbot_settings',
|
||||||
|
label: 'default_storage_helper',
|
||||||
|
value: 'local-storage-helper',
|
||||||
|
type: SettingType.select,
|
||||||
|
config: {
|
||||||
|
multiple: false,
|
||||||
|
allowCreate: false,
|
||||||
|
entity: 'Helper',
|
||||||
|
idKey: 'name',
|
||||||
|
labelKey: 'name',
|
||||||
|
},
|
||||||
|
weight: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
upsert: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
logger.log('Successfuly added the default local storage helper setting');
|
logger.log('Successfuly added the default local storage helper setting');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error('Unable to add the default local storage helper setting');
|
logger.error('Unable to add the default local storage helper setting');
|
||||||
|
Loading…
Reference in New Issue
Block a user