very-express 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -114,36 +114,30 @@ class {{interfaceName}}Controller {
|
|
|
114
114
|
|
|
115
115
|
export default new {{interfaceName}}Controller().router;
|
|
116
116
|
`;
|
|
117
|
-
template = template.replace(/{{headerComment}}/g, templateOptions.headerComment);
|
|
118
|
-
template = template.replace(/{{interfaceName}}/g, templateOptions.interfaceName);
|
|
119
|
-
template = template.replace(/{{modelPath}}/g, templateOptions.modelPath);
|
|
120
117
|
const indent2 = '\n ';
|
|
121
118
|
const indent3 = '\n ';
|
|
122
119
|
const indent4 = '\n ';
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
template = template.replace(/{{deleteRoute}}/g, `this.router.delete('/:id', ${indent3}[${indent4 + templateOptions.validator[templateOptions.endpoint + '/{id}'].delete.join(',' + indent4) + indent3}],${indent3}this.delete${templateOptions.interfaceName}.bind(this)${indent2});`);
|
|
145
|
-
}
|
|
146
|
-
;
|
|
120
|
+
template = template.replace(/{{headerComment}}/g, templateOptions.headerComment);
|
|
121
|
+
template = template.replace(/{{interfaceName}}/g, templateOptions.interfaceName);
|
|
122
|
+
template = template.replace(/{{modelPath}}/g, templateOptions.modelPath);
|
|
123
|
+
template = template.replace(/{{getListRoute}}/g, !templateOptions.validator[templateOptions.endpoint].get ?
|
|
124
|
+
'' :
|
|
125
|
+
`this.router.get('/', ${indent3}[${indent4 + templateOptions.validator[templateOptions.endpoint].get.join(',' + indent4) + indent3}],${indent3}this.getList${templateOptions.interfaceName}.bind(this)${indent2});`);
|
|
126
|
+
template = template.replace(/{{getOneRoute}}/g, !templateOptions.validator[templateOptions.endpoint + '/{id}'].get ?
|
|
127
|
+
'' :
|
|
128
|
+
`this.router.get('/:id', ${indent3}[${indent4 + templateOptions.validator[templateOptions.endpoint + '/{id}'].get.join(',' + indent4) + indent3}],${indent3}this.get${templateOptions.interfaceName}.bind(this)${indent2});`);
|
|
129
|
+
template = template.replace(/{{postRoute}}/g, !templateOptions.validator[templateOptions.endpoint].post ?
|
|
130
|
+
'' :
|
|
131
|
+
`this.router.post('/', ${indent3}[${indent4 + templateOptions.validator[templateOptions.endpoint].post.join(',' + indent4) + indent3}],${indent3}this.create${templateOptions.interfaceName}.bind(this)${indent2});`);
|
|
132
|
+
template = template.replace(/{{putRoute}}/g, !templateOptions.validator[templateOptions.endpoint + '/{id}'].put ?
|
|
133
|
+
'' :
|
|
134
|
+
`this.router.put('/:id', ${indent3}[${indent4 + templateOptions.validator[templateOptions.endpoint + '/{id}'].put.join(',' + indent4) + indent3}],${indent3}this.update${templateOptions.interfaceName}.bind(this)${indent2});`);
|
|
135
|
+
template = template.replace(/{{patchRoute}}/g, !templateOptions.validator[templateOptions.endpoint + '/{id}'].patch ?
|
|
136
|
+
'' :
|
|
137
|
+
`this.router.patch('/:id', ${indent3}[${indent4 + templateOptions.validator[templateOptions.endpoint + '/{id}'].patch.join(',' + indent4) + indent3}],${indent3}this.update${templateOptions.interfaceName}.bind(this)${indent2});`);
|
|
138
|
+
template = template.replace(/{{deleteRoute}}/g, !templateOptions.validator[templateOptions.endpoint + '/{id}'].delete ?
|
|
139
|
+
'' :
|
|
140
|
+
`this.router.delete('/:id', ${indent3}[${indent4 + templateOptions.validator[templateOptions.endpoint + '/{id}'].delete.join(',' + indent4) + indent3}],${indent3}this.delete${templateOptions.interfaceName}.bind(this)${indent2});`);
|
|
147
141
|
return template;
|
|
148
142
|
}
|
|
149
143
|
exports.default = controllerTemplate;
|