@@ -4,77 +4,107 @@ import { ConnectionEntity } from '../../connection/connection.entity.js';
44import { CustomFieldsEntity } from '../../custom-field/custom-fields.entity.js' ;
55import { TableActionEntity } from '../../table-actions/table-actions-module/table-action.entity.js' ;
66import { TableWidgetEntity } from '../../widget/table-widget.entity.js' ;
7+ import { QueryOrderingEnum } from '../../../enums/query-ordering.enum.js' ;
78
89@Entity ( 'tableSettings' )
910@Unique ( [ 'connection_id' , 'table_name' ] )
1011export class TableSettingsEntity {
11- @PrimaryGeneratedColumn ( 'uuid' )
12- id : string ;
12+ @PrimaryGeneratedColumn ( 'uuid' )
13+ id : string ;
1314
14- @Column ( { default : null } )
15- table_name : string ;
15+ @Column ( { default : null } )
16+ table_name : string ;
1617
17- @Column ( { default : null } )
18- display_name : string ;
18+ @Column ( { default : null } )
19+ display_name : string ;
1920
20- @Column ( 'varchar' , { array : true , default : { } } )
21- search_fields : string [ ] ;
21+ @Column ( 'varchar' , { array : true , default : { } } )
22+ search_fields : string [ ] ;
2223
23- @Column ( 'varchar' , { array : true , default : { } } )
24- excluded_fields : string [ ] ;
24+ @Column ( 'varchar' , { array : true , default : { } } )
25+ excluded_fields : string [ ] ;
2526
26- @Column ( 'varchar' , { array : true , default : { } } )
27- identification_fields : string [ ] ;
27+ @Column ( 'varchar' , { array : true , default : { } } )
28+ list_fields : string [ ] ;
2829
29- @Column ( { default : null } )
30- identity_column : string ;
30+ @Column ( 'varchar' , { array : true , default : { } } )
31+ identification_fields : string [ ] ;
3132
32- @Column ( 'varchar ' , { array : true , default : { } } )
33- readonly_fields : string [ ] ;
33+ @Column ( 'int ' , { default : null } )
34+ list_per_page : number ;
3435
35- @Column ( 'varchar' , { array : true , default : { } } )
36- sortable_by : string [ ] ;
36+ @Column ( 'enum' , {
37+ nullable : true ,
38+ enum : QueryOrderingEnum ,
39+ default : null ,
40+ } )
41+ ordering ! : QueryOrderingEnum ;
3742
38- @Column ( 'varchar' , { array : true , default : { } } )
39- autocomplete_columns : string [ ] ;
43+ @Column ( 'varchar' , { default : null } )
44+ ordering_field : string ;
4045
41- @Column ( 'varchar' , { array : true , default : null } )
42- columns_view : string [ ] ;
46+ @Column ( { default : null } )
47+ identity_column : string ;
4348
44- @Column ( { default : true , type : 'boolean' } )
45- can_delete : boolean ;
49+ @Column ( 'varchar' , { array : true , default : { } } )
50+ readonly_fields : string [ ] ;
4651
47- @Column ( { default : true , type : 'boolean' } )
48- can_update : boolean ;
52+ @Column ( 'varchar' , { array : true , default : { } } )
53+ sortable_by : string [ ] ;
4954
50- @Column ( { default : true , type : 'boolean' } )
51- can_add : boolean ;
55+ @Column ( 'varchar' , { array : true , default : { } } )
56+ autocomplete_columns : string [ ] ;
5257
53- @Column ( { default : true , type : 'boolean' } )
54- allow_csv_export : boolean ;
58+ @Column ( 'varchar' , { array : true , default : null } )
59+ columns_view : string [ ] ;
5560
56- @Column ( { default : true , type : 'boolean' } )
57- allow_csv_import : boolean ;
61+ @Column ( { default : true , type : 'boolean' } )
62+ can_delete : boolean ;
5863
59- @Column ( 'varchar' , { array : true , default : null } )
60- sensitive_fields : string [ ] ;
64+ @Column ( { default : true , type : 'boolean' } )
65+ can_update : boolean ;
6166
62- @Column ( 'varchar' , { default : null } )
63- icon : string ;
67+ @Column ( { default : true , type : 'boolean' } )
68+ can_add : boolean ;
6469
65- @Transform ( ( { value : connection } ) => connection . id )
66- @ManyToOne ( ( _ ) => ConnectionEntity , ( connection ) => connection . settings , {
67- onDelete : 'CASCADE' ,
68- } )
69- @JoinColumn ( )
70- connection_id : Relation < ConnectionEntity > ;
70+ @Column ( { default : true , type : 'boolean' } )
71+ allow_csv_export : boolean ;
7172
72- @ OneToMany ( ( _ ) => CustomFieldsEntity , ( fields ) => fields . settings )
73- custom_fields : Relation < CustomFieldsEntity > [ ] ;
73+ @ Column ( { default : true , type : 'boolean' } )
74+ allow_csv_import : boolean ;
7475
75- @ OneToMany ( ( _ ) => TableWidgetEntity , ( table_widgets ) => table_widgets . settings )
76- table_widgets : Relation < TableWidgetEntity > [ ] ;
76+ @ Column ( 'varchar' , { array : true , default : null } )
77+ sensitive_fields : string [ ] ;
7778
78- @OneToMany ( ( _ ) => TableActionEntity , ( table_actions ) => table_actions . settings )
79- table_actions : Relation < TableActionEntity > [ ] ;
79+ @Column ( 'varchar' , { default : null } )
80+ icon : string ;
81+
82+ @Transform ( ( { value : connection } ) => connection . id )
83+ @ManyToOne (
84+ ( _ ) => ConnectionEntity ,
85+ ( connection ) => connection . settings ,
86+ {
87+ onDelete : 'CASCADE' ,
88+ } ,
89+ )
90+ @JoinColumn ( )
91+ connection_id : Relation < ConnectionEntity > ;
92+
93+ @OneToMany (
94+ ( _ ) => CustomFieldsEntity ,
95+ ( fields ) => fields . settings ,
96+ )
97+ custom_fields : Relation < CustomFieldsEntity > [ ] ;
98+
99+ @OneToMany (
100+ ( _ ) => TableWidgetEntity ,
101+ ( table_widgets ) => table_widgets . settings ,
102+ )
103+ table_widgets : Relation < TableWidgetEntity > [ ] ;
104+
105+ @OneToMany (
106+ ( _ ) => TableActionEntity ,
107+ ( table_actions ) => table_actions . settings ,
108+ )
109+ table_actions : Relation < TableActionEntity > [ ] ;
80110}
0 commit comments