fix: support fuzzy logs user search
This commit is contained in:
@@ -692,8 +692,14 @@ export async function getLogs(options: {
|
||||
let where = timeWhere(params, options.startTs, options.endTs);
|
||||
|
||||
if (options.username) {
|
||||
params.push(options.username);
|
||||
where += ` AND username = $${params.length}`;
|
||||
params.push(`%${options.username}%`);
|
||||
where += ` AND (
|
||||
username ILIKE $${params.length}
|
||||
OR user_id IN (
|
||||
SELECT id FROM users
|
||||
WHERE display_name ILIKE $${params.length} OR users.username ILIKE $${params.length}
|
||||
)
|
||||
)`;
|
||||
}
|
||||
if (options.model) {
|
||||
params.push(options.model);
|
||||
|
||||
Reference in New Issue
Block a user