File tree Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change 36
36
"license" : " MIT" ,
37
37
"peerDependencies" : {
38
38
"adminjs" : " ^5.0.0" ,
39
- "typeorm" : " >= 0.2.28 "
39
+ "typeorm" : " ^ 0.2.45 "
40
40
},
41
41
"optionalDependencies" : {},
42
42
"devDependencies" : {
46
46
"@types/chai" : " ^4.2.4" ,
47
47
"@types/mocha" : " ^5.2.7" ,
48
48
"@types/node" : " 12.0.10" ,
49
- "chai" : " ^4.2.0" ,
50
- "class-validator" : " ^0.11.0" ,
51
- "mocha" : " ^6.2.2" ,
52
- "pg" : " ^7.12.1" ,
53
- "ts-node" : " ^8.4.1" ,
54
- "tsconfig-paths" : " ^3.9.0" ,
55
49
"@typescript-eslint/eslint-plugin" : " ^3.7.0" ,
56
50
"@typescript-eslint/parser" : " ^3.7.0" ,
57
51
"adminjs" : " ^5.0.0" ,
52
+ "chai" : " ^4.2.0" ,
53
+ "class-validator" : " ^0.11.0" ,
58
54
"eslint" : " ^7.5.0" ,
59
55
"eslint-config-airbnb" : " ^18.2.0" ,
60
56
"eslint-plugin-import" : " ^2.22.0" ,
61
57
"eslint-plugin-jsx-a11y" : " ^6.3.1" ,
62
58
"eslint-plugin-react" : " ^7.20.3" ,
63
59
"eslint-plugin-react-hooks" : " ^4.0.8" ,
64
60
"husky" : " ^4.2.5" ,
61
+ "mocha" : " ^6.2.2" ,
62
+ "pg" : " ^7.12.1" ,
65
63
"semantic-release" : " ^17.0.7" ,
66
64
"semantic-release-slack-bot" : " ^1.6.2" ,
67
- "typeorm" : " ^0.2.28" ,
65
+ "ts-node" : " ^8.4.1" ,
66
+ "tsconfig-paths" : " ^3.9.0" ,
67
+ "typeorm" : " ^0.2.45" ,
68
68
"typescript" : " ^4.0.3"
69
69
}
70
70
}
Original file line number Diff line number Diff line change 1
- import { Like } from 'typeorm'
1
+ import { Like , Raw } from 'typeorm'
2
+ import { Property } from '../../Property'
2
3
import { FilterParser } from './filter.types'
3
4
4
5
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
6
6
7
export const DefaultParser : FilterParser = {
7
8
isParserForType : ( filter ) => filter . property . type ( ) === 'string' ,
8
9
parse : ( filter , fieldKey ) => {
9
- if ( uuidRegex . test ( filter . value . toString ( ) ) ) {
10
- return { filterKey : fieldKey , filterValue : filter . value }
10
+ if ( uuidRegex . test ( filter . value . toString ( ) ) || ( filter . property as Property ) . column . type === 'uuid' ) {
11
+ return {
12
+ filterKey : fieldKey ,
13
+ filterValue : Raw (
14
+ ( alias ) => `CAST(${ alias } AS text) = :value` ,
15
+ { value : filter . value } ,
16
+ ) ,
17
+ }
11
18
}
12
19
return { filterKey : fieldKey , filterValue : Like ( `%${ filter . value } %` ) }
13
20
} ,
You can’t perform that action at this time.
0 commit comments