fix(06.2): CR-01 event-type filter uses prefix LIKE match instead of exact equality
This commit is contained in:
@@ -117,7 +117,7 @@ def _build_filtered_query(
|
||||
if user_id is not None:
|
||||
q = q.where(AuditLog.user_id == user_id)
|
||||
if event_type is not None:
|
||||
q = q.where(AuditLog.event_type == event_type)
|
||||
q = q.where(AuditLog.event_type.like(f"{event_type}%"))
|
||||
return q
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ def _build_filtered_query_with_handles(
|
||||
if user_uuid is not None:
|
||||
q = q.where(AuditLog.user_id == user_uuid)
|
||||
if event_type is not None:
|
||||
q = q.where(AuditLog.event_type == event_type)
|
||||
q = q.where(AuditLog.event_type.like(f"{event_type}%"))
|
||||
return q
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ async def list_audit_log(
|
||||
if user_uuid is not None:
|
||||
count_q = count_q.where(AuditLog.user_id == user_uuid)
|
||||
if event_type is not None:
|
||||
count_q = count_q.where(AuditLog.event_type == event_type)
|
||||
count_q = count_q.where(AuditLog.event_type.like(f"{event_type}%"))
|
||||
count_result = await session.execute(count_q)
|
||||
total = count_result.scalar_one()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user