From 5463395b04857533ab4543bf162d99ea569611e8 Mon Sep 17 00:00:00 2001 From: jisangs Date: Sun, 5 Jul 2026 14:16:35 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9E=91=EC=97=85=20=EB=82=B4=EC=9A=A9=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 6 ++++++ docs/plan/project-plan.md | 26 +++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 85f499f..7779cfd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -74,6 +74,7 @@ Always record a log entry after a successful DB change. Use these `Type` values: | `update_maestro_allow_enter_code` | AllowEditEnterCode changed (admin, new) | `{prev} -> {new}` (0 or 1) | | `request_extension_maestro` | Admin-initiated extension request created | `{maestroName}({accountTypeLabel})` | | `request_upgrade_maestro` | Admin-initiated upgrade request created | `{registeredAccountTypeLabel} -> {requestedAccountTypeLabel}` | +| `reset_maestro_password` | Maestro password reset to 123456 by admin | `admin reset to 123456` | `Remark` column is `char(100)` — keep values under 100 characters. @@ -88,6 +89,11 @@ Always record a log entry after a successful DB change. Use these `Type` values: - `POST /api/maestros/[id]/upgrade-requests` — inserts into `maestro_upgrade` inside a transaction; validates `requestedAccountType > maestro.AccountType`. - `ExtensionRequestsSection.tsx`, `UpgradeRequestsSection.tsx` — client components with inline action UI; call `router.refresh()` on success. - `PAID_ACCOUNT_TYPE_VALUES` consolidated in `lib/constants.ts` — shared by `lib/maestros.ts`, `lib/extension-requests.ts`, `lib/upgrade-requests.ts`, and both new API routes. +- Phase 15: + - Password reset button (`암호 초기화`) added to `MaestroEditForm.tsx` — calls `POST /api/maestros/[id]/reset-password`, shows `window.confirm` with maestro name, displays inline success/error message. + - `resetMaestroPassword(maestroID)` added to `lib/maestros.ts` — runs `UPDATE maestro SET Password = PASSWORD('123456')` inside a `$transaction` with a `reset_maestro_password` log entry. + - `app/api/maestros/[id]/reset-password/route.ts` — `POST` handler wrapped with `withApiHandler`. + - Deployment shell scripts added: `scripts/deploy-stage.sh` and `scripts/deploy-production.sh` — each runs git pull, ensures proxy-network, `docker compose up -d --build --remove-orphans`, and `docker exec npm nginx -s reload`. Production script requires `yes` confirmation. - Phase 13 (security/correctness fixes): - P0-1: `getActionTarget` in `lib/extension-requests.ts` replaced with inline `select` (no `include: { maestro: true }`) — prevents `Password` from appearing in debug result logs. - P0-2: Approve/cancel/reject flows in both `lib/extension-requests.ts` and `lib/upgrade-requests.ts` now use an atomic `updateMany({ Status: REQUESTED → target })` guard; `count === 0` triggers 404/409 — eliminates concurrent double-processing. diff --git a/docs/plan/project-plan.md b/docs/plan/project-plan.md index 1f7fcb9..33e4dc2 100644 --- a/docs/plan/project-plan.md +++ b/docs/plan/project-plan.md @@ -179,7 +179,8 @@ chocoadmin/ │ │ ├── route.ts # GET: 상세, PATCH: 정보 수정 │ │ ├── students/route.ts # GET: 학생 목록 │ │ ├── extension-requests/route.ts # POST: 연장 신청 등록 (관리자 직접) -│ │ └── upgrade-requests/route.ts # POST: 업그레이드 신청 등록 (관리자 직접) +│ │ ├── upgrade-requests/route.ts # POST: 업그레이드 신청 등록 (관리자 직접) +│ │ └── reset-password/route.ts # POST: 비밀번호 123456 초기화 │ ├── extension-requests/ │ │ └── [id]/route.ts # PATCH: 승인/취소 │ └── upgrade-requests/ @@ -541,9 +542,24 @@ chocoadmin/ - [x] 모든 항목 완료 (P0-1 ~ P2-8) -### Phase 14. Production/Stage 배포 환경 안정화 +### Phase 14. 비밀번호 초기화 및 배포 스크립트 -> Production 첫 배포 과정에서 발견된 이슈들을 해결했다. +> 마에스트로 계정 비밀번호 초기화 기능을 추가한다. +> 완료 날짜: 2026-07-05 + +- [x] 비밀번호 초기화 API 구현 (`POST /api/maestros/[id]/reset-password`) + - [x] `resetMaestroPassword(maestroID)` 추가 (`lib/maestros.ts`) + - [x] `$transaction` 내에서 `UPDATE maestro SET Password = PASSWORD('123456')` 실행 + - [x] `reset_maestro_password` 타입으로 `maestro_log` 기록 + - [x] `withApiHandler`로 인증·에러 처리 공통화 +- [x] 비밀번호 초기화 버튼 UI (`MaestroEditForm.tsx`) + - [x] `[암호 초기화]` 버튼을 `[저장]` 버튼 우측에 추가 (`variant="outline"`, `KeyRound` 아이콘) + - [x] `window.confirm`으로 `{마에스트로명} 계정의 비밀번호를 123456으로 초기화 하시겠습니까?` 확인 + - [x] 성공 시 기존 메시지 영역에 `암호 초기화 완료` 표시 + +### Phase 15. Production/Stage 배포 환경 안정화 + +> Production 첫 배포 과정에서 발견된 이슈들을 해결하고 NAS 배포 자동화 스크립트를 추가한다. > 완료 날짜: 2026-07-05 - [x] Production 배포 경로 생성 및 git pull 방식 배포 설정 @@ -563,6 +579,10 @@ chocoadmin/ - 인라인 `"use server"` 클로저는 빌드마다 새 ID 부여 → 재배포 후 `Failed to find Server Action` - 코드베이스 전체 인라인 서버 액션 검토 및 동일 패턴 수정 완료 - [x] Production/Stage 동시 운영 정상 확인 +- [x] 배포 자동화 스크립트 추가 (`scripts/`) + - [x] `scripts/deploy-stage.sh` — git pull → proxy-network 확인 → `docker compose -f docker-compose.stage.yml up -d --build --remove-orphans` → NPM reload + - [x] `scripts/deploy-production.sh` — `yes` 입력 확인 후 동일 5단계 실행 (`docker-compose.yml` 사용) + - [x] 각 스크립트는 NAS 해당 디렉토리에서 직접 실행 ---