@devstroupe/devkit-cli 1.1.15 → 1.1.16
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.
|
@@ -25,12 +25,15 @@ function nestDomainEntityTemplate(name, properties, isTenantScoped, automaticFie
|
|
|
25
25
|
return ` ${relation.foreignKey}!: number;\n ${relation.relationName}?: any;`;
|
|
26
26
|
}
|
|
27
27
|
let typeStr = 'string';
|
|
28
|
-
if (p.type === 'number' || p.type === 'decimal' || p.type === 'currency') {
|
|
28
|
+
if (p.type === 'number' || p.type === 'decimal' || p.type === 'currency' || p.type === 'integer') {
|
|
29
29
|
typeStr = 'number';
|
|
30
30
|
}
|
|
31
31
|
else if (p.type === 'boolean') {
|
|
32
32
|
typeStr = 'boolean';
|
|
33
33
|
}
|
|
34
|
+
else if (p.type === 'datepicker' || p.type === 'datetime' || p.type === 'date') {
|
|
35
|
+
typeStr = 'string | Date';
|
|
36
|
+
}
|
|
34
37
|
else if (p.type === 'enum' && p.enumOptions) {
|
|
35
38
|
typeStr = p.enumOptions.map(o => `'${o}'`).join(' | ');
|
|
36
39
|
}
|
|
@@ -195,11 +198,16 @@ function nestOrmEntityTemplate(name, properties, tableName, isTenantScoped, inde
|
|
|
195
198
|
}
|
|
196
199
|
const indexDecorators = indexes && indexes.length > 0
|
|
197
200
|
? indexes.map(idx => {
|
|
198
|
-
const nameOption = idx.name ? `name: '${idx.name}'` : '';
|
|
199
201
|
const uniqueOption = idx.unique ? `unique: true` : '';
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
const nameOption = idx.name ? `'${idx.name}'` : '';
|
|
203
|
+
if (nameOption) {
|
|
204
|
+
const optStr = uniqueOption ? `, { ${uniqueOption} }` : '';
|
|
205
|
+
return `@Index(${nameOption}, ${JSON.stringify(idx.columns)}${optStr})`;
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
const optStr = uniqueOption ? `, { ${uniqueOption} }` : '';
|
|
209
|
+
return `@Index(${JSON.stringify(idx.columns)}${optStr})`;
|
|
210
|
+
}
|
|
203
211
|
}).join('\n') + '\n'
|
|
204
212
|
: '';
|
|
205
213
|
return `import { ${typeormImports.join(', ')} } from 'typeorm';${relImportsStr}
|
|
@@ -245,6 +253,9 @@ function nestRepositoryAdapterTemplate(name, properties, isTenantScoped) {
|
|
|
245
253
|
.join('\n');
|
|
246
254
|
const mapToOrmProperties = persistedProperties.map((property) => {
|
|
247
255
|
if (property.type !== 'relationship') {
|
|
256
|
+
if (property.type === 'datepicker' || property.type === 'datetime' || property.type === 'date') {
|
|
257
|
+
return ` if (domain.${property.name} !== undefined) orm.${property.name} = typeof domain.${property.name} === 'string' ? new Date(domain.${property.name}) : domain.${property.name};`;
|
|
258
|
+
}
|
|
248
259
|
return ` if (domain.${property.name} !== undefined) orm.${property.name} = domain.${property.name};`;
|
|
249
260
|
}
|
|
250
261
|
const relation = (0, relationships_1.getRelationships)([property])[0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devstroupe/devkit-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.16",
|
|
4
4
|
"description": "DevsTroupe Development Kit CLI — scaffold NestJS+Angular projects, inject Spartan UI, generate CRUDs and audit architectural governance",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"commander": "^12.0.0",
|
|
38
38
|
"fs-extra": "^11.2.0",
|
|
39
|
-
"@devstroupe/devkit-core": "1.1.
|
|
39
|
+
"@devstroupe/devkit-core": "1.1.16"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/fs-extra": "^11.0.4",
|