Skip to content

Commit

Permalink
fix rows, permissions filter
Browse files Browse the repository at this point in the history
  • Loading branch information
altrpkotov committed Apr 6, 2022
1 parent ba21120 commit b1dd5f4
Show file tree
Hide file tree
Showing 6 changed files with 79,438 additions and 79,497 deletions.
5 changes: 3 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"presets": [
"@babel/env",
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
Expand All @@ -16,6 +16,7 @@
{
"loose": true
}
]
],
["@babel/plugin-proposal-private-property-in-object", { "loose": true }]
]
}
9 changes: 8 additions & 1 deletion altrpnjs/app/Controllers/Http/users/PermissionsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ export default class PermissionsController {

const params = request.qs();
const page = parseInt(params.page) || 1
const searchWord = params.s
let permissions

if (searchWord) {
permissions = await Permission.query().where('name', 'LIKE', `%${searchWord}%`).paginate(page, 20)
} else {
permissions = await Permission.query().paginate(page, 20)
}

const permissions = await Permission.query().paginate(page, 20)

return {
count: permissions.getMeta().total,
Expand Down
8 changes: 7 additions & 1 deletion altrpnjs/app/Controllers/Http/users/RolesController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ export default class RolesController {

const params = request.qs();
const page = parseInt(params.page) || 1
const searchWord = params.s
let roles

const roles = await Role.query().paginate(page, 20)
if (searchWord) {
roles = await Role.query().orWhere('name', 'LIKE', `%${searchWord}%`).orWhere('display_name', 'LIKE', `%${searchWord}%`).paginate(page, 20)
} else {
roles = await Role.query().paginate(page, 20)
}

return {
count: roles.getMeta().total,
Expand Down
Loading

0 comments on commit b1dd5f4

Please sign in to comment.