add user preference

This commit is contained in:
2024-12-02 13:47:17 +07:00
parent a93d4db18d
commit 2722ba8d95
5 changed files with 67 additions and 55 deletions

View File

@ -18,6 +18,7 @@ export class UserRoleController {
/*
#swagger.tags = ['User Roles']
#swagger.parameters['filter'] = {
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
in: 'query',
type: 'string'
}
@ -72,13 +73,11 @@ export class UserRoleController {
const offset = (param.page - 1) * param.limit
let whereAttr = '';
let whereVal: any = {};
if (param.filter) {
whereAttr = 'name like :filter_like';
whereVal['filter_like'] = '%' + param.filter + '%'
}
const { whereAttr, whereVal } = CommonHelper.handleFilter({
filter: param.filter,
col_any_eq: [],
col_any_like: ['name']
});
const res_count = repo.createQueryBuilder()
.where(whereAttr, whereVal);
@ -111,6 +110,7 @@ export class UserRoleController {
/*
#swagger.tags = ['User Roles']
#swagger.parameters['filter'] = {
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
in: 'query',
type: 'string'
}
@ -149,13 +149,11 @@ export class UserRoleController {
const repo = OrmHelper.DB.getRepository(UserRole);
let whereAttr = '';
let whereVal: any = {};
if (param.filter) {
whereAttr = 'name like :filter_like';
whereVal['filter_like'] = '%' + param.filter + '%'
}
const { whereAttr, whereVal } = CommonHelper.handleFilter({
filter: param.filter,
col_any_eq: [],
col_any_like: ['name']
});
const filename = "user_role.csv";