작업 내용 반영

This commit is contained in:
2026-07-05 14:16:35 +09:00
parent b9219da6a4
commit 5463395b04
2 changed files with 29 additions and 3 deletions
+6
View File
@@ -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.
+23 -3
View File
@@ -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 해당 디렉토리에서 직접 실행
---