'use strict'; /** * A set of functions called "actions" for `<%= globalID %>` */ module.exports = { /** * Get <%= humanizeId %> entries. * * @return {Object|Array} */ find: async (ctx, next) => { try { ctx.body = await strapi.services.<%= humanizeId %>.fetchAll(ctx.query); } catch (err) { ctx.body = err; } }, /** * Get a specific <%= humanizeId %>. * * @return {Object|Array} */ findOne: async (ctx, next) => { try { ctx.body = await strapi.services.<%= humanizeId %>.fetch(ctx.params) } catch (err) { ctx.body = err; } }, /** * Create a/an <%= humanizeId %> entry. * * @return {Object} */ create: async (ctx, next) => { try { ctx.body = await strapi.services.<%= humanizeId %>.add(ctx.request.body); } catch (err) { ctx.body = err; } }, /** * Update a/an <%= humanizeId %> entry. * * @return {Object} */ update: async (ctx, next) => { try { ctx.body = await strapi.services.<%= humanizeId %>.edit(ctx.params, ctx.request.body) ; } catch (err) { ctx.body = err; } }, /** * Destroy a/an <%= humanizeId %> entry. * * @return {Object} */ destroy: async (ctx, next) => { try { ctx.body = await strapi.services.<%= humanizeId %>.remove(ctx.params); } catch (err) { ctx.body = err; } } };