File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed
Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,12 @@ export class Property extends BaseProperty {
2626 return ! ! this . column . primary ;
2727 }
2828
29+ public isRequired ( ) : boolean {
30+ if ( this . column . nullable === false ) return true ;
31+
32+ return false ;
33+ }
34+
2935 public isSortable ( ) : boolean {
3036 return this . type ( ) !== 'reference' ;
3137 }
@@ -53,12 +59,15 @@ export class Property extends BaseProperty {
5359 }
5460
5561 public type ( ) : PropertyType {
56- let type : PropertyType = DATA_TYPES [ this . column . columnTypes [ 0 ] ] ;
62+ let type : PropertyType = DATA_TYPES [ this . column . columnTypes [ 0 ] ]
63+ || DATA_TYPES [ this . column . type ] ;
5764
5865 if ( this . reference ( ) ) { type = 'reference' ; }
5966
6067 // eslint-disable-next-line no-console
61- if ( ! type ) { console . warn ( `Unhandled type: ${ this . column . type } ` ) ; }
68+ if ( ! type ) {
69+ console . warn ( `Unhandled type: ${ this . column . type } ` ) ;
70+ }
6271
6372 return type ;
6473 }
Original file line number Diff line number Diff line change @@ -181,7 +181,10 @@ export class Resource extends BaseResource {
181181 try {
182182 await this . orm . em . persistAndFlush ( instance ) ;
183183 } catch ( error ) {
184- if ( error . name === 'QueryFailedError' ) {
184+ // TODO: figure out how to get column name from MikroORM's error metadata
185+ // It currently seems to return only whole Entity
186+ console . log ( error ) ;
187+ if ( error . name === 'QueryFailedError' || error . name === 'ValidationError' ) {
185188 throw new ValidationError ( {
186189 [ error . column ] : {
187190 type : 'QueryFailedError' ,
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ const NUMBER = [
2626 'fixed' ,
2727 'numeric' ,
2828 'number' ,
29+ 'serial' ,
2930
3031 // WithWidthColumnType:
3132 'tinyint' ,
You can’t perform that action at this time.
0 commit comments