changes to property visibility functionality

This commit is contained in:
Kononnable 2018-11-01 19:05:53 +01:00
parent 8fc25aeb5e
commit 0484b1254a
5 changed files with 912 additions and 913 deletions

View File

@ -1,8 +1,8 @@
# Changelog
## 0.3.0
## 0.2.24
* Allow to define property visibility, by using --pv
* __Feature:__ Allow to define property visibility, by using --pv
## 0.2.23
* added column type to generated `@PrimaryGeneratedColumn` decorator

1810
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "typeorm-model-generator",
"version": "0.3.0",
"version": "0.2.22",
"description": "Generates models for TypeORM from existing databases.",
"bin": "bin/typeorm-model-generator",
"scripts": {
@ -12,8 +12,7 @@
"posttest": "remap-istanbul -i ./coverage/coverage.json -o ./coverage/coverage-remapped.json && codecov --file=./coverage/coverage-remapped.json ",
"clean": "rimraf dist coverage output",
"prettier": "prettier --write ./src/*.ts ./src/**/*.ts",
"prepack": "npm run compile",
"postpack": "npm run clean"
"prepack": "npm run compile"
},
"repository": {
"type": "git",
@ -68,4 +67,4 @@
"sinon": "^6.0.0",
"sinon-chai": "^3.0.0"
}
}
}

View File

@ -155,7 +155,7 @@ export class Engine {
"printPropertyVisibility",
() =>
this.Options.propertyVisibility !== "none"
? this.Options.propertyVisibility
? this.Options.propertyVisibility + " "
: ""
);
Handlebars.registerHelper("toPropertyName", str => {

View File

@ -23,7 +23,7 @@ import {Index,Entity, PrimaryColumn, PrimaryGeneratedColumn, Column, OneToOne, O
array:{{is_array}},{{/is_array}}
name:"{{sqlName}}"
})
{{printPropertyVisibility}} {{toPropertyName tsName}}:{{ts_type}}{{#is_nullable}} | null{{/is_nullable}};
{{printPropertyVisibility}}{{toPropertyName tsName}}:{{ts_type}}{{#is_nullable}} | null{{/is_nullable}};
{{/relations}}{{#relations}}
@{{relationType}}(type=>{{toEntityName relatedTable}}, {{toEntityName relatedTable}}=>{{toEntityName relatedTable}}.{{#if isOwner}}{{toPropertyName ownerColumn}},{ {{#../isPrimary}}primary:true,{{/../isPrimary}}{{^../is_nullable}} nullable:false,{{/../is_nullable}}{{#actionOnDelete}}onDelete: '{{.}}',{{/actionOnDelete}}{{#actionOnUpdate}}onUpdate: '{{.}}'{{/actionOnUpdate}} }{{else}}{{toPropertyName relatedColumn}}{{#if (or actionOnDelete actionOnUpdate ) }}{{#actionOnDelete}},{ onDelete: '{{.}}' ,{{/actionOnDelete}}{{#actionOnUpdate}}onUpdate: '{{.}}'{{/actionOnUpdate}} }{{/if}}{{/if}}){{#isOwner}}
{{#if isManyToMany}}@JoinTable(){{else}}@JoinColumn({ name:'{{ ../sqlName}}'}){{/if}}{{/isOwner}}