Merge remote-tracking branch 'origin/main' into codex/api-analytics-hardening

# Conflicts:
#	README.md
#	lib/queries.test.ts
#	lib/queries.ts
This commit is contained in:
2026-05-27 15:30:26 +08:00
4 changed files with 52 additions and 7 deletions

View File

@@ -56,8 +56,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);