@alevnyacow/nzmt 0.12.0 → 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.
Files changed (2) hide show
  1. package/bin/cli.js +7 -5
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -861,7 +861,7 @@ function generateController(upperCase, lowerCase, crudService) {
861
861
  injections = injections.concat(crudService)
862
862
  }
863
863
 
864
- const crudServiceLowercase = crudService ? crudService.substring(0, 1).toUpperCase() + crudService.substring(1) : undefined
864
+ const crudServiceLowercase = crudService ? crudService.substring(0, 1).toLowerCase() + crudService.substring(1) : undefined
865
865
 
866
866
  const importInjections = injections.map((i) => {
867
867
  if (i.endsWith('Controller')) {
@@ -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 { Controller } from '@alevnyacow/nzmt'`,
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 = {`,
@@ -893,9 +894,9 @@ function generateController(upperCase, lowerCase, crudService) {
893
894
  `\tschemas: {`,
894
895
  `\t\tGET: {`,
895
896
  `\t\t\tquery: z.union([`,
896
- `\t\t\t\tValueObjects.Pagination.schema.extend(${crudServiceLowercase}Metadata.schemas.getList.payload.shape.filter.shape),`
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,12 +946,13 @@ 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 })`,
949
+ `\t})`,
948
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)`,
952
954
  `\tDELETE = this.endpoints('DELETE', this.${crudServiceLowercase}.delete)`,
953
- ].join('\n') : undefined
955
+ ].join('\n') : undefined,
954
956
  `}`
955
957
  ].filter(x => typeof x === 'string').join('\n'))
956
958
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alevnyacow/nzmt",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "description": "Next Zod Modules Toolkit",
5
5
  "repository": {
6
6
  "type": "git",