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 3636 "license" : " MIT" ,
3737 "peerDependencies" : {
3838 "adminjs" : " ^5.0.0" ,
39- "typeorm" : " >= 0.2.28 "
39+ "typeorm" : " ^ 0.2.45 "
4040 },
4141 "optionalDependencies" : {},
4242 "devDependencies" : {
4646 "@types/chai" : " ^4.2.4" ,
4747 "@types/mocha" : " ^5.2.7" ,
4848 "@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" ,
5549 "@typescript-eslint/eslint-plugin" : " ^3.7.0" ,
5650 "@typescript-eslint/parser" : " ^3.7.0" ,
5751 "adminjs" : " ^5.0.0" ,
52+ "chai" : " ^4.2.0" ,
53+ "class-validator" : " ^0.11.0" ,
5854 "eslint" : " ^7.5.0" ,
5955 "eslint-config-airbnb" : " ^18.2.0" ,
6056 "eslint-plugin-import" : " ^2.22.0" ,
6157 "eslint-plugin-jsx-a11y" : " ^6.3.1" ,
6258 "eslint-plugin-react" : " ^7.20.3" ,
6359 "eslint-plugin-react-hooks" : " ^4.0.8" ,
6460 "husky" : " ^4.2.5" ,
61+ "mocha" : " ^6.2.2" ,
62+ "pg" : " ^7.12.1" ,
6563 "semantic-release" : " ^17.0.7" ,
6664 "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" ,
6868 "typescript" : " ^4.0.3"
6969 }
7070}
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'
23import { FilterParser } from './filter.types'
34
45const 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
56
67export const DefaultParser : FilterParser = {
78 isParserForType : ( filter ) => filter . property . type ( ) === 'string' ,
89 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+ }
1118 }
1219 return { filterKey : fieldKey , filterValue : Like ( `%${ filter . value } %` ) }
1320 } ,
You can’t perform that action at this time.
0 commit comments