it seems that when we apply two upload functionalities for one resource at the same time they mix up together and one of them tend not to show up.
const AdminBro = require('admin-bro');
const { Blog } = require('../../models/Blog');
const { sort, timestamps } = require('../sort');
const uploadFeature = require('@admin-bro/upload');
const path = require('path');
const fs = require('fs');
/** @type {AdminBro.ResourceOptions} */
const options = {
name: 'Blog (customize field)',
sort,
properties: {
...timestamps,
slug: {
position: 0,
},
description: {
isVisible: {list: false, edit: true, filter: false, show: true},
position: 1,
components: {
edit: AdminBro.bundle('../components/custom-fonts.edit.tsx')
}
},
tags: {
isVisible: {list: false, edit: true, filter: true, show: true},
position: 8
},
keywords: {
isVisible: {list: false, edit: true, filter: true, show: true},
position: 9
},
draftMode: {
isVisible: {list: true, edit: true, filter: true, show: true},
},
_id: {
isVisible: { list: false, edit: false, filter: false, show: false},
},
},
};
module.exports = {
options,
resource: Blog,
features: [
uploadFeature({
provider: { local: { bucket: path.join(__dirname, '../../uploads') } },
properties: {
key: 'featuredPhoto.path',
bucket: 'featuredPhoto.folder',
mimeType: 'featuredPhoto.type',
size: 'featuredPhoto.size',
filename: 'featuredPhoto.filename',
file: 'featuredPhoto',
},
}),
uploadFeature({
provider: { local: { bucket: path.join(__dirname, '../../uploads') } },
properties: {
key: 'thumbnailPhoto.path',
bucket: 'thumbnailPhoto.folder',
mimeType: 'thumbnailPhoto.type',
size: 'thumbnailPhoto.size',
filename: 'thumbnailPhoto.filename',
file: 'thumbnailPhoto',
},
}),
],
};
const mongoose = require('mongoose');
mongoose.Promise = global.Promise;
const slug = require('slugs');
const blogSchema = new mongoose.Schema({
title: {
type: String,
trim: true,
required: 'لطفا یک عنوان برای مقاله وارد کنید.'
},
slug: {
type: String,
trim: true,
required: 'لطفا لینک مقاله را وارد کنید.'
},
description: {
type: String,
required: 'توضیحات مربوط به مقاله را وارد کنید.'
},
category: [{
type: mongoose.Schema.Types.ObjectId,
ref: 'Category',
}],
subCategory: [{
type: mongoose.Schema.Types.ObjectId,
ref: 'SubCategory',
}],
tags: {
type: [String]
},
authors: { type: mongoose.Schema.ObjectId, ref:'Admin', required: 'نام نوینسده را انتخاب کنید' },
keywords: {
type: [String]
},
draftMode: {
type: Boolean,
default: false
}
}, { timestamps: true } );
blogSchema.virtual('admins', {
ref: 'Admin',
localField: 'authors',
foreignField: '_id',
});
const FeaturedPhoto = new mongoose.Schema({
path: String,
type: String,
size: Number,
folder: String,
filename: String,
});
const ThumbnailPhoto = new mongoose.Schema({
path: String,
type: String,
size: Number,
folder: String,
filename: String,
});
const Blog = mongoose.model('Blog', { blogSchema, featuredPhoto: FeaturedPhoto, thumbnailPhoto: ThumbnailPhoto, }, );
module.exports = { blogSchema, Blog, ThumbnailPhoto, FeaturedPhoto, };
thanks for the support and maintanance.