Skip to content

Commit

Permalink
feat: templates adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
fbatiga committed Apr 12, 2023
1 parent e0eddcd commit 15a801b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/commands/generate/templates/controllers/mongo.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module.exports = {
}

query = Tools.injectQueryParams(req, query);
options = Tools.injectSortParams(req, options);
options = Tools.injectMongoSortParams(req, options);
}

collection
Expand Down
24 changes: 24 additions & 0 deletions src/commands/generate/templates/controllers/sql.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ const modelName = '<%= entityCamelCased %>';

class <%= entityClass %>Controller {
/**
* [find all Item]
* [description]
* @method
* @param {import('express').Request} req
* @param {import('express').Response} resp
* @return {void} [description]
*/
async findAll(req, resp, next) {
try {
let items = [];
Expand Down Expand Up @@ -73,6 +81,14 @@ class <%= entityClass %>Controller {
}
}

/**
* [find one Item]
* [description]
* @method
* @param {import('express').Request} req
* @param {import('express').Response} resp
* @return {void} [description]
*/
async findOne(req, resp, next) {
const id = req.params.id;
try {
Expand Down Expand Up @@ -109,6 +125,14 @@ class <%= entityClass %>Controller {
}
}

/**
* [create Item]
* [description]
* @method
* @param {import('express').Request} req
* @param {import('express').Response} resp
* @return {void} [description]
*/
async create(req, resp, next) {
const data = Utils.injectUserId(req.body, req.user, ['createdBy']); // replace field by userId or any other relevant field
try {
Expand Down

0 comments on commit 15a801b

Please sign in to comment.