docs: 사원-회원 연결 기능 문서 추가
- changes/20251225_employee_user_linkage.md: 변경 이력 문서 - plans/employee-user-linkage-plan.md: 구현 계획 문서 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
78
changes/20251225_employee_user_linkage.md
Normal file
78
changes/20251225_employee_user_linkage.md
Normal file
@@ -0,0 +1,78 @@
|
||||
# 변경 내용 요약
|
||||
|
||||
**날짜:** 2025-12-25
|
||||
**작업자:** Claude Code
|
||||
**이슈:** employee-user-linkage-plan.md 구현
|
||||
|
||||
## 📋 변경 개요
|
||||
사원-회원 연결 기능의 핵심 API 구현:
|
||||
- 사원 전용 등록 (시스템 계정 없이)
|
||||
- 계정 해제 기능 (revokeAccount)
|
||||
|
||||
## 📁 수정된 파일
|
||||
|
||||
### 1. api/app/Services/EmployeeService.php
|
||||
- **store()**: password 생성 로직 수정 - `create_account=false`면 password=NULL 허용
|
||||
- **revokeAccount()**: 신규 메서드 추가 - 시스템 계정 해제 (password=NULL, 토큰 무효화)
|
||||
|
||||
### 2. api/app/Http/Controllers/Api/V1/EmployeeController.php
|
||||
- **revokeAccount()**: 신규 액션 추가
|
||||
- **createAccount()**: 응답 메시지 i18n 키로 변경
|
||||
|
||||
### 3. api/routes/api.php
|
||||
- `POST /employees/{id}/revoke-account` 라우트 추가
|
||||
|
||||
### 4. api/lang/ko/employee.php (신규)
|
||||
- 사원 관련 메시지 키 정의
|
||||
|
||||
### 5. api/lang/en/employee.php (신규)
|
||||
- 영문 메시지 키 정의
|
||||
|
||||
## 🔧 상세 변경 사항
|
||||
|
||||
### 1. EmployeeService::store() 수정
|
||||
|
||||
**변경 전:**
|
||||
```php
|
||||
'password' => Hash::make($data['password'] ?? Str::random(16)),
|
||||
```
|
||||
|
||||
**변경 후:**
|
||||
```php
|
||||
$password = null;
|
||||
$createAccount = $data['create_account'] ?? false;
|
||||
if ($createAccount && ! empty($data['password'])) {
|
||||
$password = Hash::make($data['password']);
|
||||
}
|
||||
// ...
|
||||
'password' => $password,
|
||||
```
|
||||
|
||||
**이유:** 사원 전용 등록 지원 (로그인 불가)
|
||||
|
||||
### 2. EmployeeService::revokeAccount() 추가
|
||||
|
||||
```php
|
||||
public function revokeAccount(int $id): TenantUserProfile
|
||||
{
|
||||
// tenant_id 격리 적용
|
||||
// password=NULL로 설정 (로그인 불가)
|
||||
// 기존 토큰 무효화
|
||||
}
|
||||
```
|
||||
|
||||
**이유:** 시스템 계정 해제 기능
|
||||
|
||||
## ✅ 테스트 체크리스트
|
||||
- [x] PHP 문법 검사 통과
|
||||
- [x] Pint 코드 포맷 통과
|
||||
- [x] 라우트 등록 확인
|
||||
- [ ] Swagger 문서 작성 (추후)
|
||||
- [ ] API 통합 테스트 (추후)
|
||||
|
||||
## ⚠️ 배포 시 주의사항
|
||||
- users.password 컬럼이 nullable인지 확인 필요
|
||||
- 기존 사원 데이터에 영향 없음
|
||||
|
||||
## 🔗 관련 문서
|
||||
- docs/plans/employee-user-linkage-plan.md
|
||||
1816
plans/employee-user-linkage-plan.md
Normal file
1816
plans/employee-user-linkage-plan.md
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user