@alevnyacow/nzmt 0.12.1 → 0.12.2
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.
- package/bin/cli.js +5 -3
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -884,7 +884,8 @@ function generateController(upperCase, lowerCase, crudService) {
|
|
|
884
884
|
// Metadata
|
|
885
885
|
|
|
886
886
|
fs.writeFileSync(path.resolve(folder, `${entityName}.controller.metadata.ts`), [
|
|
887
|
-
`import
|
|
887
|
+
crudService ? `import z from 'zod'` : undefined,
|
|
888
|
+
`import { Controller, ValueObjects } from '@alevnyacow/nzmt'`,
|
|
888
889
|
crudService ? `import { ${crudServiceLowercase}Metadata } from '@${config.paths.services}/${toKebabFromPascal(crudService).slice(0, -'-service'.length)}'` : undefined
|
|
889
890
|
``,
|
|
890
891
|
`export const ${lowerCase}ControllerMetadata = {`,
|
|
@@ -895,7 +896,7 @@ function generateController(upperCase, lowerCase, crudService) {
|
|
|
895
896
|
`\t\t\tquery: z.union([`,
|
|
896
897
|
`\t\t\t\tValueObjects.Pagination.schema.extend(${crudServiceLowercase}Metadata.schemas.getList.payload.shape.filter.shape),`,
|
|
897
898
|
`\t\t\t\t${crudServiceLowercase}Metadata.schemas.getList.payload.shape.filter`,
|
|
898
|
-
`\t\t\t])
|
|
899
|
+
`\t\t\t]),`,
|
|
899
900
|
`\t\t\tresponse: ${crudServiceLowercase}Metadata.schemas.getList.response`,
|
|
900
901
|
`\t\t},`,
|
|
901
902
|
`\t\tdetails_GET: {`,
|
|
@@ -945,7 +946,8 @@ function generateController(upperCase, lowerCase, crudService) {
|
|
|
945
946
|
`\t\t\treturn await this.${crudServiceLowercase}.getList({ filter, pagination: { pageSize, zeroBasedIndex } })`,
|
|
946
947
|
`\t\t}`,
|
|
947
948
|
`\t\treturn await this.${crudServiceLowercase}.getList({ filter: x })`,
|
|
948
|
-
`\t}`,
|
|
949
|
+
`\t})`,
|
|
950
|
+
``,
|
|
949
951
|
`\tdetails_GET = this.endpoints('details_GET', this.${crudServiceLowercase}.getDetails)`,
|
|
950
952
|
`\tPOST = this.endpoints('POST', this.${crudServiceLowercase}.create)`,
|
|
951
953
|
`\tPATCH = this.endpoints('PATCH', this.${crudServiceLowercase}.update)`,
|