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

@ -16,6 +16,7 @@ export class UserRefreshTokenController {
/*
#swagger.tags = ['User Refresh Token']
#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 {name:\'admin\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
in: 'query',
type: 'string'
}
@ -64,16 +65,13 @@ export class UserRefreshTokenController {
const offset = (param.page - 1) * param.limit
let whereAttr = '';
let whereVal: any = {};
const { whereAttr, whereVal } = CommonHelper.handleFilter({
filter: param.filter,
col_any_eq: [],
col_any_like: ['device', 'platform'],
additional_where: 'id_user = :id_user'
});
if (param.filter) {
whereAttr = '(name like :filter_like or username like :filter_like or email = :filter) and ';
whereVal['filter'] = param.filter
whereVal['filter_like'] = '%' + param.filter + '%'
}
whereAttr += 'id_user = :id_user'
whereVal['id_user'] = req.auth.data.id;
const res_count = repo.createQueryBuilder()