mirror of
https://github.com/strapi/strapi.git
synced 2025-12-25 22:23:10 +00:00
remove content-manager call in upload services
This commit is contained in:
parent
078d677526
commit
239c065972
@ -89,7 +89,7 @@ module.exports = {
|
||||
values.fields[attr] = [];
|
||||
});
|
||||
|
||||
const data = parseFormData(values.fileds);
|
||||
const data = parseFormData(values.fields);
|
||||
const updatedEntity = await strapi
|
||||
.query(params.model, source)
|
||||
.update({ id: params.id }, data);
|
||||
|
||||
@ -91,24 +91,10 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
async add(values) {
|
||||
add(values) {
|
||||
return strapi.query('file', 'upload').create(values);
|
||||
},
|
||||
|
||||
async edit(params, values) {
|
||||
// Use Content Manager business logic to handle relation.
|
||||
if (strapi.plugins['content-manager']) {
|
||||
params.model = 'file';
|
||||
params.id = params._id || params.id;
|
||||
|
||||
return await strapi.plugins['content-manager'].services[
|
||||
'contentmanager'
|
||||
].edit(params, values, 'upload');
|
||||
}
|
||||
|
||||
return strapi.query('file', 'upload').update(params, values);
|
||||
},
|
||||
|
||||
fetch(params) {
|
||||
return strapi.query('file', 'upload').findOne({
|
||||
id: params._id || params.id,
|
||||
@ -124,9 +110,9 @@ module.exports = {
|
||||
},
|
||||
|
||||
async remove(params, config) {
|
||||
params.id = params._id || params.id;
|
||||
const opts = { id: params._id || params.id };
|
||||
|
||||
const file = await strapi.plugins['upload'].services.upload.fetch(params);
|
||||
const file = await strapi.plugins['upload'].services.upload.fetch(opts);
|
||||
|
||||
// get upload provider settings to configure the provider to use
|
||||
const provider = _.cloneDeep(
|
||||
@ -142,16 +128,7 @@ module.exports = {
|
||||
await actions.delete(file);
|
||||
}
|
||||
|
||||
// Use Content Manager business logic to handle relation.
|
||||
if (strapi.plugins['content-manager']) {
|
||||
params.model = 'file';
|
||||
|
||||
return await strapi.plugins['content-manager'].services[
|
||||
'contentmanager'
|
||||
].delete(params, { source: 'upload' });
|
||||
}
|
||||
|
||||
return strapi.query('file', 'upload').delete(params);
|
||||
return strapi.query('file', 'upload').delete(opts);
|
||||
},
|
||||
|
||||
async uploadToEntity(params, files, source) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user