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

@ -19,6 +19,7 @@ export class UserController {
/*
#swagger.tags = ['User']
#swagger.parameters['filter'] = {
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:email or like %name% or like %username%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
in: 'query',
type: 'string'
}
@ -111,6 +112,7 @@ export class UserController {
/*
#swagger.tags = ['User']
#swagger.parameters['filter'] = {
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:email or like %name% or like %username%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
in: 'query',
type: 'string'
}
@ -149,14 +151,11 @@ export class UserController {
const userRepository = OrmHelper.DB.getRepository(User);
let whereAttr = '';
let whereVal: any = {};
if (param.filter) {
whereAttr = 'name like :filter_like or username like :filter_like or email = :filter ';
whereVal['filter'] = param.filter
whereVal['filter_like'] = '%' + param.filter + '%'
}
const { whereAttr, whereVal } = CommonHelper.handleFilter({
filter: param.filter,
col_any_eq: ['email'],
col_any_like: ['name', 'username']
});
const filename = "user.csv";