Skip to content

Backend admin user preferences: NCP map enabled toggle #156

Description

@tkdgusqkr

Scope

어드민 운영자별로 NCP Maps SDK 호출 여부를 토글로 제어할 수 있게 한다. 토글은 `admin_users` 에 영구 저장되어 어떤 PC/브라우저로 접속해도 일관된 상태가 유지된다. 프론트 후속 슬라이스(C-2)가 이 endpoint 를 사용해 MapShell 가드를 hostname 기반에서 user setting 기반으로 교체.

Included:

  • Flyway V10 마이그레이션: `admin_users.ncp_map_enabled BOOLEAN NOT NULL DEFAULT TRUE` 추가.
  • `AdminUserAccount` record 에 `ncpMapEnabled` 필드 추가.
  • `AdminUserAccountRepository` select 갱신 + 새 `updateNcpMapEnabled(UUID, boolean)` 메소드.
  • 신규 `AdminPreferencesController`:
    • `GET /api/v1/admin-users/me/preferences` — JWT sub 로 본인 setting 조회.
    • `PATCH /api/v1/admin-users/me/preferences` — `{ ncpMapEnabled: true|false }` 입력.
  • 신규 `AdminPreferencesService` (read + update).
  • DTO: `AdminPreferencesResponse` / `AdminPreferencesUpdateRequest`.
  • ArchUnit issue_70 화이트리스트에 새 PATCH 컨트롤러 등록.
  • 통합 테스트.

기본값 결정:

  • 새 컬럼은 default `TRUE` — 기존 운영자도 마이그레이션 직후 NCP 호출이 켜진 상태. 운영자가 명시적으로 끄지 않으면 ON 유지.
  • AdminSeedRunner 가 만드는 시드 어드민도 동일 default 적용.

Excluded:

  • 다른 사용자 setting 추가 (현재는 NCP 토글 한 개).
  • 운영자가 다른 운영자의 setting 을 보거나 수정 (본인 것만).
  • 프론트 변경 (Slice C-2 가 별도).

Acceptance criteria

  • 마이그레이션 후 기존 `admin_users` 모든 행에 `ncp_map_enabled = true`.
  • `GET /me/preferences` 가 인증 사용자의 `{ ncpMapEnabled }` 반환.
  • `PATCH /me/preferences` 로 토글 변경 → 다음 GET 응답이 갱신된 값.
  • 인증 없이 호출 시 401.
  • 다른 사용자 ID 로 우회 불가 (URL 에 path param 없음 — 항상 JWT sub 사용).
  • ArchUnit / 기존 통합 테스트 회귀 없음.
  • `./gradlew test` / `./gradlew build` 통과.

Trace

Concurrent work gate

Decision: allowed-with-non-overlap
Evidence:

  • Open target issues: none.
  • Open target PRs: none.
  • Active branches: dev, main.
    Reason: backend-only auth 도메인 확장 + 신규 admin user preferences 패키지.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions