Skip to content

Commit e4c2c81

Browse files
committed
refactor(controller.js): fix eslint warnings in basename.controller.js
1 parent 94ef86e commit e4c2c81

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: templates/endpoint/basename.controller.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function respondWithResult(res, statusCode) {
2727
function patchUpdates(patches) {
2828
return function(entity) {
2929
try {
30+
// eslint-disable-next-line prefer-reflect
3031
jsonpatch.apply(entity, patches, /*validate*/ true);
3132
} catch(err) {
3233
return Promise.reject(err);
@@ -98,7 +99,7 @@ export function create(req, res) {
9899
// Upserts the given <%= classedName %> in the DB at the specified ID
99100
export function upsert(req, res) {
100101
if(req.body._id) {
101-
delete req.body._id;
102+
Reflect.deleteProperty(req.body, '_id');
102103
}
103104
<%_ if(filters.mongooseModels) { -%>
104105
return <%= classedName %>.findOneAndUpdate({_id: req.params.id}, req.body, {new: true, upsert: true, setDefaultsOnInsert: true, runValidators: true}).exec()<% } %>
@@ -115,7 +116,7 @@ export function upsert(req, res) {
115116
// Updates an existing <%= classedName %> in the DB
116117
export function patch(req, res) {
117118
if(req.body._id) {
118-
delete req.body._id;
119+
Reflect.deleteProperty(req.body, '_id');
119120
}
120121
<% if(filters.mongooseModels) { %>return <%= classedName %>.findById(req.params.id).exec()<% }
121122
if(filters.sequelizeModels) { %>return <%= classedName %>.find({

0 commit comments

Comments
 (0)