update access token expired time

This commit is contained in:
2024-12-01 20:54:56 +07:00
parent f565b9b8b0
commit a93d4db18d
4 changed files with 110 additions and 36 deletions

View File

@ -73,44 +73,17 @@ export class UserController {
const offset = (param.page - 1) * param.limit
let whereAttr = [];
let whereVal: any = {};
if (param.filter) {
param.filter = JSON.parse(param.filter);
let filter_any = false;
let filter_any_val = '';
for (let p in param.filter) {
let f = String(param.filter[p])
if (p != 'any') {
if (!validate(f)) {
whereAttr.push("LOWER(" + p + ") = :" + p);
f = f.toLowerCase();
} else {
whereAttr.push(p + " = :" + p);
}
whereVal[p] = f;
} else {
filter_any = true;
filter_any_val = f;
}
}
if (filter_any) {
whereAttr.push('(name like :filter_like or username like :filter_like or email = :filter) ');
whereVal['filter'] = filter_any_val
whereVal['filter_like'] = '%' + filter_any_val + '%'
}
}
const { whereAttr, whereVal } = CommonHelper.handleFilter({
filter: param.filter,
col_any_eq: ['email'],
col_any_like: ['name', 'username']
});
const res_count = userRepository.createQueryBuilder()
.where(whereAttr.join(' and '), whereVal);
.where(whereAttr, whereVal);
const res_list = userRepository.createQueryBuilder()
.where(whereAttr.join(' and '), whereVal)
.where(whereAttr, whereVal)
.orderBy(param.order_field, param.order_direction)
.offset(offset)
.limit(param.limit);