File tree Expand file tree Collapse file tree 4 files changed +26
-3
lines changed Expand file tree Collapse file tree 4 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -76,4 +76,27 @@ export default {
76
76
props . recordData . description = description ;
77
77
return { } ;
78
78
} ,
79
+ methods : {
80
+ async formatRecordData ( ) {
81
+ const recordData = this . recordData ;
82
+ const { columns } = await this . app . listColumns ( {
83
+ endpoint : this . endpoint ,
84
+ database : this . database ,
85
+ branch : this . branch ,
86
+ table : this . table ,
87
+ } ) ;
88
+ if ( ! columns ?. length ) {
89
+ return this . recordData ;
90
+ }
91
+ for ( const column of columns ) {
92
+ if ( recordData [ column . name ] && ( column . type === "int" || column . type === "float" ) ) {
93
+ recordData [ column . name ] = + recordData [ column . name ] ;
94
+ }
95
+ if ( recordData [ column . name ] && column . type === "bool" ) {
96
+ recordData [ column . name ] = ! ( recordData [ column . name ] === "false" || recordData [ column . name === "0" ] ) ;
97
+ }
98
+ }
99
+ return recordData ;
100
+ } ,
101
+ } ,
79
102
} ;
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export default {
23
23
database : this . database ,
24
24
branch : this . branch ,
25
25
table : this . table ,
26
- data : this . recordData ,
26
+ data : await this . formatRecordData ( ) ,
27
27
} ) ;
28
28
$ . export ( "$summary" , `Successfully created Record with ID: '${ response . id } '` ) ;
29
29
return response ;
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export default {
36
36
branch : this . branch ,
37
37
table : this . table ,
38
38
recordId : this . recordId ,
39
- data : this . recordData ,
39
+ data : await this . formatRecordData ( ) ,
40
40
} ) ;
41
41
$ . export ( "$summary" , `Successfully replaced Record with ID: '${ response . id } '` ) ;
42
42
return response ;
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export default {
36
36
branch : this . branch ,
37
37
table : this . table ,
38
38
recordId : this . recordId ,
39
- data : this . recordData ,
39
+ data : await this . formatRecordData ( ) ,
40
40
} ) ;
41
41
$ . export ( "$summary" , `Successfully updated/created Record with ID: '${ response . id } '` ) ;
42
42
return response ;
You can’t perform that action at this time.
0 commit comments