@neohm/nh-cli 1.1.1 → 1.1.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/README.md +2 -1
- package/package.json +1 -1
- package/src/lib/templates.js +11 -6
package/README.md
CHANGED
|
@@ -90,13 +90,14 @@ created spreading `baseJobConstants` / `baseEntityConstants` /
|
|
|
90
90
|
Generated artifacts extend the `@neohm/nestend` base classes:
|
|
91
91
|
|
|
92
92
|
- Entity → `CommonEntity` (with an empty `attributes` jsonb column)
|
|
93
|
-
- DTO → `
|
|
93
|
+
- DTO → `CommonDataDto`
|
|
94
94
|
- Data processor → `CommonDataProcessor` (`process()` → `validate()` → `set()`)
|
|
95
95
|
- Listing processor → `CommonListProcessor` (column allowlist config, `id` default sort). It takes `CommonListFilterDto` directly — no per-list DTO is generated, since paging, sorting, filters and free-text search all live on the base DTO and the filterable columns are declared in the processor's `columns` config.
|
|
96
96
|
|
|
97
97
|
When both a controller and a listing processor are generated, the controller
|
|
98
98
|
ships with a `POST list` endpoint that runs the listing processor (with
|
|
99
99
|
`SqlService` injected via the constructor).
|
|
100
|
+
|
|
100
101
|
- Migration → `MigrationUtility`
|
|
101
102
|
- Seed → `SeederUtility`
|
|
102
103
|
|
package/package.json
CHANGED
package/src/lib/templates.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
toDotCase,
|
|
5
|
+
toPascalCase,
|
|
6
|
+
toKebabCase,
|
|
7
|
+
toCamelCase,
|
|
8
|
+
} = require("./naming");
|
|
4
9
|
|
|
5
10
|
/**
|
|
6
11
|
* Code templates. All generated code imports shared base classes from the
|
|
7
12
|
* published library `@neohm/nestend` (verified exports: CommonEntity,
|
|
8
|
-
*
|
|
13
|
+
* CommonDataDto, CommonDataProcessor, MigrationUtility, SeederUtility, etc.)
|
|
9
14
|
* and matches the dot.separated filename / PascalCase class conventions used
|
|
10
15
|
* across nestjs-boilerplate.
|
|
11
16
|
*/
|
|
@@ -94,9 +99,9 @@ export class ${n.controllerClass} {
|
|
|
94
99
|
|
|
95
100
|
function dto(base) {
|
|
96
101
|
const n = names(base);
|
|
97
|
-
return `import {
|
|
102
|
+
return `import { CommonDataDto } from '@neohm/nestend';
|
|
98
103
|
|
|
99
|
-
export class ${n.dtoClass} extends
|
|
104
|
+
export class ${n.dtoClass} extends CommonDataDto {
|
|
100
105
|
// TODO: declare validated payload fields for ${n.pascal}.
|
|
101
106
|
}
|
|
102
107
|
`;
|
|
@@ -120,7 +125,7 @@ export class ${n.processorClass} extends CommonDataProcessor {
|
|
|
120
125
|
|
|
121
126
|
private async validate() {
|
|
122
127
|
// TODO: collect validation errors via this.addErrors({ column: 'message' }).
|
|
123
|
-
this.
|
|
128
|
+
this.raiseExceptionOnValidationFailure();
|
|
124
129
|
}
|
|
125
130
|
|
|
126
131
|
private async set() {
|