@alevnyacow/nzmt 0.15.1 → 0.15.3
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/README.md +4 -2
- package/bin/cli.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,9 +67,11 @@ This will generate:
|
|
|
67
67
|
|
|
68
68
|
**All code is editable - you stay in full control!**
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
So, only two things left to do:
|
|
71
71
|
|
|
72
|
-
-
|
|
72
|
+
- Describe entity properties and validation rules using Zod for the `User` entity in the scaffolded file `/shared/entities/user/user.entity.ts`.
|
|
73
|
+
|
|
74
|
+
- Implement Prisma mappers in `/server/stores/user/user.store.prisma.ts`.
|
|
73
75
|
All methods and contracts are already scaffolded; you only need to describe the mappers themselves. RAM store implementation works out of the box.
|
|
74
76
|
|
|
75
77
|
# Design principles
|
package/bin/cli.js
CHANGED
|
@@ -925,7 +925,7 @@ function generateController(upperCase, lowerCase, crudService) {
|
|
|
925
925
|
`\t\t},`,
|
|
926
926
|
`\t\tdetails_GET: {`,
|
|
927
927
|
`\t\t\tquery: ${crudServiceLowercase}Metadata.schemas.getDetails.payload,`,
|
|
928
|
-
`\t\t\tresponse: ${crudServiceLowercase}Metadata.schemas.getDetails.response`,
|
|
928
|
+
`\t\t\tresponse: ${crudServiceLowercase}Metadata.schemas.getDetails.response.options[0]`,
|
|
929
929
|
`\t\t},`,
|
|
930
930
|
`\t\tPOST: {`,
|
|
931
931
|
`\t\t\tbody: ${crudServiceLowercase}Metadata.schemas.create.payload,`,
|
|
@@ -972,7 +972,12 @@ function generateController(upperCase, lowerCase, crudService) {
|
|
|
972
972
|
`\t\treturn await this.${crudServiceLowercase}.getList({ filter: x })`,
|
|
973
973
|
`\t})`,
|
|
974
974
|
``,
|
|
975
|
-
`\tdetails_GET = this.endpoints('details_GET',
|
|
975
|
+
`\tdetails_GET = this.endpoints('details_GET', async (payload, { endpointError ) => {`,
|
|
976
|
+
`\t\tconst details = await this.${crudServiceLowercase}.getDetails`,
|
|
977
|
+
`\t\tif (!details) { throw endpointError('No data was found', 404) }`,
|
|
978
|
+
`\t\treturn details`,
|
|
979
|
+
`\t})`,
|
|
980
|
+
``,
|
|
976
981
|
`\tPOST = this.endpoints('POST', this.${crudServiceLowercase}.create)`,
|
|
977
982
|
`\tPATCH = this.endpoints('PATCH', this.${crudServiceLowercase}.update)`,
|
|
978
983
|
`\tDELETE = this.endpoints('DELETE', this.${crudServiceLowercase}.delete)`,
|