Skip to content

Commit 9791350

Browse files
author
Agnes Lin
committed
feat(cli): update controller template to enable filter for findById endpoint
1 parent 1094509 commit 9791350

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/cli/generators/controller/templates/src/controllers/controller-rest-template.ts.ejs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,11 @@ export class <%= className %>Controller {
112112
},
113113
},
114114
})
115-
async findById(@param.path.<%= idType %>('id') id: <%= idType %>): Promise<<%= modelName %>> {
116-
return this.<%= repositoryNameCamel %>.findById(id);
115+
async findById(
116+
@param.path.<%= idType %>('id') id: <%= idType %>,
117+
@param.query.object('filter', getFilterSchemaFor(<%= modelName %>)) filter?: Filter<<%= modelName %>>
118+
): Promise<<%= modelName %>> {
119+
return this.<%= repositoryNameCamel %>.findById(id, filter);
117120
}
118121

119122
@patch('<%= httpPathName %>/{id}', {

0 commit comments

Comments
 (0)