1.2.6 • Published 2 years ago

typeorm-mui-query v1.2.6

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

MUI TypeORM querybuilder

If you use TypeORM and MUI Data Grid server-side filter or server-side sorting this project can be helpful.

Install

npm install typeorm-mui-query

Example

Frontend

const [queryOptions, setQueryOptions] = useState({
  filterModel: {
    items: [],
  },
  sortModel: [],
})

const handleSortModelChange: DataGridProProps['onSortModelChange'] = useCallback((sortModel) => {
  setQueryOptions((currentState) => ({ ...currentState, sortModel }))
}, [])

const handleFilterModelChange: DataGridProProps['onFilterModelChange'] = useCallback(
  (filterModel) => {
    setQueryOptions((currentState) => ({ ...currentState, filterModel }))
  },
  []
)

const query = new URLSearchParams({
  ...queryOptions,
  sortModel: JSON.stringify(queryOptions.sortModel),
  filterModel: JSON.stringify(queryOptions.filterModel),
})
const results = await API.get('default', `/example?${query.toString()}`, {})

Backend

import { handleQuery } from 'typeorm-mui-query'

handleQuery({ qb, queryStringParameters })
const results = await qb.getMany()
1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago