feat(audit): 감사 로그 서버 필터링 적용 - #62
Conversation
- 상태와 기간 필터를 감사 로그 API 쿼리 파라미터로 전달 - 서버에서 필터링 후 페이지네이션이 적용되도록 변경 - 감사 로그 필터링 동작 테스트 추가
|
@codex review |
values_callable 없이 SQLEnum을 사용하면 enum 이름(대문자)이 DB에 저장되어 마이그레이션의 소문자 enum 값과 불일치가 발생함. enum_values 헬퍼를 추가하고 모든 감사 로그 enum 컬럼에 values_callable을 적용하여 .value(소문자)가 저장되도록 통일.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b67f7469df
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if startDate is not None: | ||
| query = query.filter( | ||
| AuditLog.occurred_at | ||
| >= datetime.combine(startDate, time.min, tzinfo=timezone.utc) |
There was a problem hiding this comment.
Preserve the user's local date boundaries
Now that date filtering happens on the server, treating the YYYY-MM-DD value from the browser as a UTC day changes the semantics from the previous local-date filtering/display. For users outside UTC, selecting a date can drop logs from the beginning of their local day or include logs from the next local day; for example a UTC-05 user filtering 2024-01-15 will miss logs between local midnight and 04:59 because they are before 2024-01-15T00:00:00Z. Pass the client timezone/offset or otherwise align the server bounds with the date semantics shown in the UI.
Useful? React with 👍 / 👎.
| setLoading(false); | ||
| } | ||
| }, []); | ||
| }, [filters]); |
There was a problem hiding this comment.
Ignore stale audit-log filter responses
Because loadLogs now depends on filters, every quick filter edit starts a new request, but older requests still call setLogs/setTotal when they finish. If a slower response for a previous status/date range resolves after the latest one, the tab will show logs and totals for filters that are no longer selected. Add a request sequence check or cancellation so only the response for the current filters updates state.
Useful? React with 👍 / 👎.
- 클라이언트에서 날짜 문자열을 로컬 타임존 기준 ISO datetime으로 변환 후 startAt/endAt으로 전송 - 서버 파라미터를 date → datetime으로 변경하고 datetime.combine 로직 제거 - 종료 날짜 비교를 <= 에서 < (다음 날 00:00)로 수정
변경 사항
관련 이슈
Closes #52
변경 유형
테스트
스크린샷 (UI 변경 시)
해당 없음