mirror of
https://github.com/strapi/strapi.git
synced 2025-08-23 08:09:10 +00:00
add comment for function
This commit is contained in:
parent
492a3c63b9
commit
c988475bf3
@ -171,6 +171,9 @@ const getAllPathsForContentType = apiInfo => {
|
||||
* @returns {object}
|
||||
*/
|
||||
const buildApiEndpointPath = api => {
|
||||
// A reusable loop for building paths and component schemas
|
||||
// Uses the api param to build a new set of params for each content type
|
||||
// Passes these new params to the function provided
|
||||
return loopContentTypeNames(api, getAllPathsForContentType);
|
||||
};
|
||||
|
||||
|
@ -108,6 +108,9 @@ const getAllSchemasForContentType = ({ routeInfo, attributes, uniqueName }) => {
|
||||
};
|
||||
|
||||
const buildComponentSchema = api => {
|
||||
// A reusable loop for building paths and component schemas
|
||||
// Uses the api param to build a new set of params for each content type
|
||||
// Passes these new params to the function provided
|
||||
return loopContentTypeNames(api, getAllSchemasForContentType);
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@ const _ = require('lodash');
|
||||
* @param {object} api - Api information to pass to the callback
|
||||
* @param {function} callback - Logic to execute for the given api
|
||||
*
|
||||
* @returns {function}
|
||||
* @returns {object}
|
||||
*/
|
||||
const loopContentTypeNames = (api, callback) => {
|
||||
let result = {};
|
||||
@ -27,6 +27,7 @@ const loopContentTypeNames = (api, callback) => {
|
||||
|
||||
// Uppercase the first letter of the api name
|
||||
const apiName = _.upperFirst(api.name);
|
||||
|
||||
// Create a unique name if the api name and contentType name don't match
|
||||
const uniqueName =
|
||||
api.name === contentTypeName ? apiName : `${apiName} - ${_.upperFirst(contentTypeName)}`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user