Skip to content

feat(audit): 감사 로그 서버 필터링 적용 - #62

Merged
yoonki1207 merged 4 commits into
devfrom
feature/mba-38
Jun 27, 2026
Merged

feat(audit): 감사 로그 서버 필터링 적용#62
yoonki1207 merged 4 commits into
devfrom
feature/mba-38

Conversation

@hojun-lee99

Copy link
Copy Markdown
Contributor

변경 사항

  • 감사 로그 조회 API에 상태, 시작일, 종료일 필터를 추가했습니다.
  • 클라이언트에서 감사 로그 필터 값을 API 쿼리 파라미터로 전달하도록 변경했습니다.
  • 서버에서 필터링을 먼저 적용한 뒤 페이지네이션되도록 테스트를 추가했습니다.

관련 이슈

Closes #52

변경 유형

  • 버그 수정
  • 새로운 기능
  • 리팩토링
  • 문서 수정
  • 기타

테스트

  • 로컬에서 테스트 완료
  • 기존 테스트 통과 확인

스크린샷 (UI 변경 시)

해당 없음

- 상태와 기간 필터를 감사 로그 API 쿼리 파라미터로 전달
- 서버에서 필터링 후 페이지네이션이 적용되도록 변경
- 감사 로그 필터링 동작 테스트 추가
@hojun-lee99
hojun-lee99 requested a review from yoonki1207 June 27, 2026 06:12
@hojun-lee99 hojun-lee99 self-assigned this Jun 27, 2026
@linear-code

linear-code Bot commented Jun 27, 2026

Copy link
Copy Markdown

MBA-38

@hojun-lee99 hojun-lee99 linked an issue Jun 27, 2026 that may be closed by this pull request
3 tasks
@yoonki1207

Copy link
Copy Markdown
Member

@codex review

values_callable 없이 SQLEnum을 사용하면 enum 이름(대문자)이 DB에 저장되어
마이그레이션의 소문자 enum 값과 불일치가 발생함.
enum_values 헬퍼를 추가하고 모든 감사 로그 enum 컬럼에 values_callable을 적용하여
.value(소문자)가 저장되도록 통일.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread apps/gateway/api/v1/endpoints/users.py Outdated
if startDate is not None:
query = query.filter(
AuditLog.occurred_at
>= datetime.combine(startDate, time.min, tzinfo=timezone.utc)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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)로 수정
@yoonki1207
yoonki1207 merged commit 6a47c73 into dev Jun 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

감사 로그 필터가 최근 50건에만 적용되는 문제

2 participants