mirror of
https://github.com/strapi/strapi.git
synced 2025-07-28 03:20:17 +00:00
24 lines
593 B
JavaScript
24 lines
593 B
JavaScript
![]() |
'use strict';
|
||
|
|
||
|
const { objectType, nonNull } = require('nexus');
|
||
|
|
||
|
const { utils, constants } = require('../../types');
|
||
|
|
||
|
const buildResponseCollectionDefinition = contentType => {
|
||
|
const name = utils.getEntityResponseCollectionName(contentType);
|
||
|
const entityName = utils.getEntityName(contentType);
|
||
|
|
||
|
return objectType({
|
||
|
name,
|
||
|
|
||
|
definition(t) {
|
||
|
t.nonNull.list.field('data', { type: nonNull(entityName) });
|
||
|
t.nonNull.field('meta', { type: constants.RESPONSE_COLLECTION_META_TYPE_NAME });
|
||
|
},
|
||
|
});
|
||
|
};
|
||
|
|
||
|
module.exports = () => ({
|
||
|
buildResponseCollectionDefinition,
|
||
|
});
|