File tree 2 files changed +1
-39
lines changed
2 files changed +1
-39
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable no-unused-vars */
2
2
import fs from 'fs'
3
3
import db from 'models/_instance'
4
- import { FilterAttributes } from 'models'
5
4
6
5
const { Sequelize } = db
7
6
const { Op } = Sequelize
@@ -19,26 +18,6 @@ function getUniqueCodev2(length = 32) {
19
18
return result
20
19
}
21
20
22
- // Filter Query Object
23
- function filterQueryObject ( filtered : FilterAttributes [ ] ) {
24
- const resultObject = { }
25
- if ( typeof filtered !== 'object' ) {
26
- throw new Error ( `Filtered must be an object, expected ${ typeof filtered } ` )
27
- }
28
-
29
- for ( let i = 0 ; i < filtered . length ; i += 1 ) {
30
- // eslint-disable-next-line prefer-const
31
- let { id, value } = filtered [ i ]
32
- if ( id . split ( '.' ) . length > 1 ) {
33
- id = `$${ id } $`
34
- }
35
- // @ts -ignore
36
- resultObject [ id ] = { [ Op . like ] : `%${ value } %` }
37
- }
38
-
39
- return resultObject
40
- }
41
-
42
21
// Read HTML File
43
22
function readHTMLFile ( path : any , callback : any ) {
44
23
fs . readFile ( path , { encoding : 'utf-8' } , function ( err , html ) {
@@ -50,4 +29,4 @@ function readHTMLFile(path: any, callback: any) {
50
29
} )
51
30
}
52
31
53
- export { getUniqueCodev2 , readHTMLFile , filterQueryObject , invalidValues }
32
+ export { getUniqueCodev2 , readHTMLFile , invalidValues }
Original file line number Diff line number Diff line change @@ -2,23 +2,6 @@ import Role from './role'
2
2
import User from './user'
3
3
import UserRole from './userrole'
4
4
5
- export interface FilterAttributes {
6
- id : string
7
- value : string
8
- }
9
-
10
- export interface SortAttributes {
11
- id : string
12
- desc : string
13
- }
14
-
15
- export interface FilterQueryAttributes {
16
- page : string | number
17
- pageSize : string | number
18
- filtered : string
19
- sorted : string
20
- }
21
-
22
5
const models = {
23
6
Role,
24
7
User,
You can’t perform that action at this time.
0 commit comments