Skip to content

feat: 프로필 부가 정보(로그인 이력·보안·알림 설정) 실데이터화 - #174

Open
BcKmini wants to merge 2 commits into
mainfrom
feat/173-profile-login-history-notifications
Open

feat: 프로필 부가 정보(로그인 이력·보안·알림 설정) 실데이터화#174
BcKmini wants to merge 2 commits into
mainfrom
feat/173-profile-login-history-notifications

Conversation

@BcKmini

@BcKmini BcKmini commented Aug 14, 2026

Copy link
Copy Markdown
Member

요약

  • user_login_event 테이블 신설 — 로그인 성공 시 User-Agent 기반 기기 요약과 함께 기록. GET /auth/me/profilerole/account_status/password_changed_at/last_login_at/last_login_device/recent_device_count를 실제 값으로 반환.
  • user_account.password_changed_at 컬럼 추가, changePassword()에서 갱신.
  • notification_preference 테이블 + GET/PATCH /api/v1/notifications/preferences 신설. 기본값 7종은 client의 INITIAL_NOTIFICATION_PREFS와 동일하게 맞췄고 security-permission은 서버에서도 끌 수 없도록 강제(422).
  • 업무 권한 세부값("담당 영역", "문서 열람 범위")처럼 서버에 대응 개념이 없는 항목은 만들지 않고 client PR에서 화면에서 제거.

테스트

  • ./gradlew test 전체: BUILD SUCCESSFUL
  • 신규: UserAgentDeviceSummarizerTest, AuthSecurityIntegrationTest#getMyProfileReflectsAccountStateAndRecordsLoginDeviceHistory, NotificationSecurityIntegrationTest의 알림 설정 조회/변경/필수항목 보호/사용자 간 격리 테스트

Closes #173

ProfilePage에 표시되던 마지막 로그인 시각/기기, 계정 상태, 비밀번호 변경일,
업무 권한, 알림 수신 설정이 전부 profileData.ts의 고정값이었던 문제를
백엔드부터 해결한다.

- user_login_event 테이블 신설, 로그인 성공 시 User-Agent 기반 기기 요약과
  함께 기록. GET /auth/me/profile이 role/account_status/password_changed_at/
  last_login_at/last_login_device/recent_device_count를 실제 값으로 반환.
  (last_login/work-context의 "담당 영역"·"문서 열람 범위"처럼 백엔드에 대응
  개념이 아예 없는 항목은 만들어내지 않고 클라이언트에서 제거 예정)
- user_account.password_changed_at 컬럼 추가, changePassword()에서 갱신.
- notification_preference 테이블 + GET/PATCH /notifications/preferences 신설.
  7개 알림 유형 기본값은 client의 기존 INITIAL_NOTIFICATION_PREFS와 동일하게
  맞췄고, security-permission은 서버에서도 끌 수 없도록 강제.

Part of the "no hardcoded profile data" cleanup requested after client#339.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
user_login_event/notification_preference 테이블이 새로 생겼는데
PostgreSqlRestrictedRoleHttpEnvironment의 TABLE_PRIVILEGES 허용목록에
반영이 안 돼 있었다. 이 목록은 실제 fowoco_runtime role 권한을 테스트용
role에 그대로 재현하는 용도라, 로그인 시 user_login_event에 INSERT하는
새 로직이 테스트 환경에서만 42501(insufficient_privilege)로 막혀
로그인 자체가 500으로 실패하고 있었다 (실제 프로덕션은 migration role의
ALTER DEFAULT PRIVILEGES로 자동 커버되어 영향 없음, 이 테스트 role만
수동 허용목록이라 별도 반영 필요).

로컬에서 Postgres 16 컨테이너로 4개 테스트 전부 통과 확인함.
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.

프로필 화면 로그인 이력·보안 정보·알림 설정 하드코딩 제거

1 participant