@graf-research/adf-codegen-model-typeorm 0.0.14 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/exec.js +0 -0
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/exec.js
CHANGED
File without changes
|
package/dist/index.js
CHANGED
@@ -72,9 +72,9 @@ var TypeORMModel;
|
|
72
72
|
case "enum": return `./model/enum/${item.name}${extension !== null && extension !== void 0 ? extension : ''}`;
|
73
73
|
}
|
74
74
|
}
|
75
|
-
function buildTableDependency(table, list_model) {
|
75
|
+
function buildTableDependency(except_self_name, table, list_model) {
|
76
76
|
return table.columns
|
77
|
-
.filter((tc) => tc.type.type === 'relation' || tc.type.type === 'enum')
|
77
|
+
.filter((tc) => (tc.type.type === 'relation' && tc.type.table_name !== except_self_name) || tc.type.type === 'enum')
|
78
78
|
.map((tc) => {
|
79
79
|
const type = tc.type;
|
80
80
|
switch (type.type) {
|
@@ -254,7 +254,7 @@ var TypeORMModel;
|
|
254
254
|
filename: getModelFileName(table, '.ts'),
|
255
255
|
content: [
|
256
256
|
'import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryColumn, PrimaryGeneratedColumn, UpdateDateColumn, BaseEntity } from "typeorm";',
|
257
|
-
...lodash_1.default.uniq(buildTableDependency(table, list_model)),
|
257
|
+
...lodash_1.default.uniq(buildTableDependency(table.name, table, list_model)),
|
258
258
|
'',
|
259
259
|
`@Entity('${table.name}')`,
|
260
260
|
`export class ${table.name} extends BaseEntity {`,
|