File tree Expand file tree Collapse file tree 2 files changed +1
-39
lines changed Expand file tree Collapse file tree 2 files changed +1
-39
lines changed Original file line number Diff line number Diff line change 11/* eslint-disable no-unused-vars */ 
22import  fs  from  'fs' 
33import  db  from  'models/_instance' 
4- import  {  FilterAttributes  }  from  'models' 
54
65const  {  Sequelize }  =  db 
76const  {  Op }  =  Sequelize 
@@ -19,26 +18,6 @@ function getUniqueCodev2(length = 32) {
1918  return  result 
2019} 
2120
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- 
4221// Read HTML File 
4322function  readHTMLFile ( path : any ,  callback : any )  { 
4423  fs . readFile ( path ,  {  encoding : 'utf-8'  } ,  function  ( err ,  html )  { 
@@ -50,4 +29,4 @@ function readHTMLFile(path: any, callback: any) {
5029  } ) 
5130} 
5231
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'
22import  User  from  './user' 
33import  UserRole  from  './userrole' 
44
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- 
225const  models  =  { 
236  Role, 
247  User, 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments