Alberto Maturano 154fc28a57 Normalize to standar file permissions
As a result of taking a look on PR #1967 I realized there is 819
executable files in this repository. It is obvious this is an error.
2018-09-24 12:33:09 -05:00

79 lines
1.3 KiB
Plaintext

'use strict';
/**
* <%= filename %> controller
*
* @description: A set of functions called "actions" for managing `<%= globalID %>`.
*/
module.exports = {
/**
* Retrieve <%= id %> records.
*
* @return {Object|Array}
*/
find: async (ctx) => {
if (ctx.query._q) {
return strapi.services.<%= id %>.search(ctx.query);
} else {
return strapi.services.<%= id %>.fetchAll(ctx.query);
}
},
/**
* Retrieve a <%= id %> record.
*
* @return {Object}
*/
findOne: async (ctx) => {
if (!ctx.params._id.match(/^[0-9a-fA-F]{24}$/)) {
return ctx.notFound();
}
return strapi.services.<%= id %>.fetch(ctx.params);
},
/**
* Count <%= id %> records.
*
* @return {Number}
*/
count: async (ctx) => {
return strapi.services.<%= id %>.count(ctx.query);
},
/**
* Create a/an <%= id %> record.
*
* @return {Object}
*/
create: async (ctx) => {
return strapi.services.<%= id %>.add(ctx.request.body);
},
/**
* Update a/an <%= id %> record.
*
* @return {Object}
*/
update: async (ctx, next) => {
return strapi.services.<%= id %>.edit(ctx.params, ctx.request.body) ;
},
/**
* Destroy a/an <%= id %> record.
*
* @return {Object}
*/
destroy: async (ctx, next) => {
return strapi.services.<%= id %>.remove(ctx.params);
}
};