mirror of
https://github.com/strapi/strapi.git
synced 2025-10-29 00:49:49 +00:00
refactor(content-manager): entity manager support single types
This commit is contained in:
parent
006a531e85
commit
de5d6b5a8c
@ -88,7 +88,13 @@ module.exports = ({ strapi }) => ({
|
||||
|
||||
const entities = await strapi.entityService.findMany(uid, params);
|
||||
|
||||
const mappedResults = await mapAsync(entities.results, (entity) => this.mapEntity(entity, uid));
|
||||
if (!entities) {
|
||||
return entities;
|
||||
}
|
||||
|
||||
const mappedResults = await mapAsync(entities.results || [entities], (entity) =>
|
||||
this.mapEntity(entity, uid)
|
||||
);
|
||||
return { ...entities, results: mappedResults };
|
||||
},
|
||||
|
||||
@ -97,7 +103,13 @@ module.exports = ({ strapi }) => ({
|
||||
|
||||
const entities = await strapi.entityService.findPage(uid, params);
|
||||
|
||||
const mappedResults = await mapAsync(entities.results, (entity) => this.mapEntity(entity, uid));
|
||||
if (!entities) {
|
||||
return entities;
|
||||
}
|
||||
|
||||
const mappedResults = await mapAsync(entities.results || [entities], (entity) =>
|
||||
this.mapEntity(entity, uid)
|
||||
);
|
||||
return { ...entities, results: mappedResults };
|
||||
},
|
||||
|
||||
@ -107,7 +119,13 @@ module.exports = ({ strapi }) => ({
|
||||
|
||||
const entities = await strapi.entityService.findWithRelationCountsPage(uid, params);
|
||||
|
||||
const mappedResults = await mapAsync(entities.results, (entity) => this.mapEntity(entity, uid));
|
||||
if (!entities) {
|
||||
return entities;
|
||||
}
|
||||
|
||||
const mappedResults = await mapAsync(entities.results || [entities], (entity) =>
|
||||
this.mapEntity(entity, uid)
|
||||
);
|
||||
return { ...entities, results: mappedResults };
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user