change populate params for all CM actions responses

This commit is contained in:
Pierre Noël 2022-09-07 11:43:01 +02:00
parent ba401b93f4
commit 5c8bac1a40

View File

@ -171,7 +171,10 @@ module.exports = ({ strapi }) => ({
publishData[PUBLISHED_AT_ATTRIBUTE] = null; publishData[PUBLISHED_AT_ATTRIBUTE] = null;
} }
const params = { data: publishData, populate: getDeepPopulate(uid) }; const params = {
data: publishData,
populate: getDeepPopulate(uid, null, { onlyMany: true, countMany: true }),
};
return strapi.entityService.create(uid, params); return strapi.entityService.create(uid, params);
}, },
@ -179,13 +182,16 @@ module.exports = ({ strapi }) => ({
update(entity, body, uid) { update(entity, body, uid) {
const publishData = omitPublishedAtField(body); const publishData = omitPublishedAtField(body);
const params = { data: publishData, populate: getDeepPopulate(uid) }; const params = {
data: publishData,
populate: getDeepPopulate(uid, null, { onlyMany: true, countMany: true }),
};
return strapi.entityService.update(uid, entity.id, params); return strapi.entityService.update(uid, entity.id, params);
}, },
delete(entity, uid) { delete(entity, uid) {
const params = { populate: getDeepPopulate(uid) }; const params = { populate: getDeepPopulate(uid, null, { onlyMany: true, countMany: true }) };
return strapi.entityService.delete(uid, entity.id, params); return strapi.entityService.delete(uid, entity.id, params);
}, },
@ -212,7 +218,10 @@ module.exports = ({ strapi }) => ({
const data = { ...body, [PUBLISHED_AT_ATTRIBUTE]: new Date() }; const data = { ...body, [PUBLISHED_AT_ATTRIBUTE]: new Date() };
const params = { data, populate: getDeepPopulate(uid) }; const params = {
data,
populate: getDeepPopulate(uid, null, { onlyMany: true, countMany: true }),
};
return strapi.entityService.update(uid, entity.id, params); return strapi.entityService.update(uid, entity.id, params);
}), }),
@ -224,7 +233,10 @@ module.exports = ({ strapi }) => ({
const data = { ...body, [PUBLISHED_AT_ATTRIBUTE]: null }; const data = { ...body, [PUBLISHED_AT_ATTRIBUTE]: null };
const params = { data, populate: getDeepPopulate(uid) }; const params = {
data,
populate: getDeepPopulate(uid, null, { onlyMany: true, countMany: true }),
};
return strapi.entityService.update(uid, entity.id, params); return strapi.entityService.update(uid, entity.id, params);
}), }),