File tree Expand file tree Collapse file tree
fixtures/add-model/expected/multiple-fields/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,22 +80,27 @@ async function * gatherModelProperty () {
8080 name : 'key' ,
8181 message : 'Property name (hit Enter to quit)'
8282 } ,
83+ {
84+ type : 'input' ,
85+ name : 'title' ,
86+ message : 'Property title'
87+ } ,
8388 {
8489 type : 'select' ,
8590 name : 'typeHint' ,
86- message : 'Property type' ,
91+ message : 'Data type' ,
8792 choices : Scaffold . ModelTypes ( )
8893 } ,
8994 {
9095 type : 'confirm' ,
9196 name : 'primary' ,
92- message : 'Primary Key' ,
97+ message : 'Is Primary Key' ,
9398 initial : false
9499 } ,
95100 {
96101 type : 'confirm' ,
97102 name : 'required' ,
98- message : 'Required' ,
103+ message : 'Is Required' ,
99104 initial : false
100105 }
101106 ]
@@ -107,6 +112,14 @@ async function * gatherModelProperty () {
107112 return
108113 }
109114 }
115+
116+ // Strip empty string properties
117+ for ( const [ k , v ] of Object . entries ( propertyDetails ) ) {
118+ if ( v === '' ) {
119+ delete propertyDetails [ k ]
120+ }
121+ }
122+
110123 yield propertyDetails
111124 }
112125} // gatherModelProperty
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ describe('tymly add-model', () => {
1111 model title,
1212 model description,
1313 field name,
14+ field title,
1415 field type,
1516 is primary key,
1617 is required,
@@ -23,6 +24,7 @@ describe('tymly add-model', () => {
2324 'Pizza' ,
2425 'A pizza' ,
2526 'name' ,
27+ '' ,
2628 'string' ,
2729 'Y' ,
2830 'Y' ,
@@ -33,18 +35,22 @@ describe('tymly add-model', () => {
3335 'Pizza' ,
3436 'A pizza' ,
3537 'code' ,
38+ '' ,
3639 'string' ,
3740 'Y' ,
3841 'Y' ,
3942 'label' ,
43+ 'Customer-facing label' ,
4044 '' ,
4145 '' ,
4246 'Y' ,
4347 'popularitySeq' ,
48+ '' ,
4449 helpers . down ,
4550 '' ,
4651 '' ,
4752 'vegetarian' ,
53+ '' ,
4854 helpers . down + helpers . down ,
4955 '' ,
5056 '' ,
Original file line number Diff line number Diff line change 88 "type" : " string"
99 },
1010 "label" : {
11+ "title" : " Customer-facing label" ,
1112 "type" : " string"
1213 },
1314 "popularitySeq" : {
You can’t perform that action at this time.
0 commit comments