File tree 3 files changed +6
-5
lines changed 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 116
116
.pnp. *
117
117
118
118
lib
119
- .vscode
119
+ .vscode
120
+ .idea
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ class Resource extends BaseResource {
84
84
85
85
async count ( filter : Filter ) {
86
86
return this . SequelizeModel . count ( ( {
87
- where : convertFilter ( filter ) ,
87
+ where : convertFilter ( filter , this . databaseType ( ) ) ,
88
88
} ) ) ;
89
89
}
90
90
@@ -119,7 +119,7 @@ class Resource extends BaseResource {
119
119
const { direction, sortBy } = sort ;
120
120
const sequelizeObjects = await this . SequelizeModel
121
121
. findAll ( {
122
- where : convertFilter ( filter ) ,
122
+ where : convertFilter ( filter , this . databaseType ( ) ) ,
123
123
limit,
124
124
offset,
125
125
order : [ [ sortBy as string , ( direction || 'asc' ) . toUpperCase ( ) ] ] ,
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { Op } from 'sequelize';
3
3
4
4
const uuidRegex = / ^ [ 0 - 9 A - F ] { 8 } - [ 0 - 9 A - F ] { 4 } - [ 5 | 4 | 3 | 2 | 1 ] [ 0 - 9 A - F ] { 3 } - [ 8 9 A B ] [ 0 - 9 A - F ] { 3 } - [ 0 - 9 A - F ] { 12 } $ / i;
5
5
6
- const convertFilter = ( filter ) => {
6
+ const convertFilter = ( filter , databaseType : string ) => {
7
7
if ( ! filter ) {
8
8
return { } ;
9
9
}
@@ -35,7 +35,7 @@ const convertFilter = (filter) => {
35
35
...( memo [ Op . and ] || [ ] ) ,
36
36
{
37
37
[ property . name ( ) ] : {
38
- [ ( Op . like as unknown ) as string ] : `%${ escape ( value ) } %` ,
38
+ [ ( databaseType === 'postgres' ? Op . iLike as unknown : Op . like as unknown ) as string ] : `%${ escape ( value ) } %` ,
39
39
} ,
40
40
} ,
41
41
] ,
You can’t perform that action at this time.
0 commit comments