updae query

This commit is contained in:
2024-11-27 15:39:43 +07:00
parent 85479256db
commit 98b6bf4cd6

View File

@ -1,4 +1,5 @@
import { Request, Response, NextFunction, Application } from "express";
import { Response, NextFunction, Application } from "express";
import { Request } from "express-jwt";
import { ReturnHelper } from "../helpers/express/return";
import { OrmHelper } from "../helpers/orm";
import { User } from "../entity/users";
@ -72,11 +73,14 @@ export class UserActivityController {
let whereVal: any = {};
if (param.filter) {
whereAttr = 'module like :filter_like or username like :filter_like or email = :filter ';
whereAttr = '(module 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 = userRepository.createQueryBuilder()
.where(whereAttr, whereVal);
const res_list = userRepository.createQueryBuilder()