diff --git a/API_SPEC.md b/API_SPEC.md index 07ee3c8..8b9b1ca 100644 --- a/API_SPEC.md +++ b/API_SPEC.md @@ -21,6 +21,18 @@ - ❌ 기존: `users.nicknames[teamId]` - ✅ 신규: `team.members[uid].nickname` +### 🎯 RESTful API 설계 규칙 +**HTTP Method로 동작 구분** (경로가 아님): +``` +✅ POST /api/resource → 생성/추가 +✅ DELETE /api/resource → 삭제/제거 +✅ PUT /api/resource → 전체 수정 +✅ GET /api/resource → 조회 + +❌ POST /api/resource/add → 사용 금지 +❌ POST /api/resource/remove → 사용 금지 +``` + --- ## 개요 @@ -325,6 +337,113 @@ interface ApiError { --- +### 🆕 11. POST `/team/:teamId/security-level` - 보안 레벨 변경 +실제 URL: `POST /api/team/:teamId/security-level` + +**인증**: 필수 (팀 소유자만) + +**Request**: +```typescript +{ + securityLevel: 1 | 2 | 3 | 4 | 5; + autoPopulateList?: boolean; // 기본값: true +} +``` + +**Response**: +```typescript +{ + success: true, + data: { + team: Team; // 업데이트된 팀 + } +} +``` + +**autoPopulateList 동작**: +- `true`: 기존 멤버를 자동으로 명단에 추가 + - Level 2로 변경 → 기존 멤버 이름을 `allowedNames`에 추가 + - Level 4로 변경 → 기존 정식 계정 이메일을 `allowedEmails`에 추가 +- `false`: 명단을 자동 생성하지 않음 (수동 관리) + +**캐시 무효화**: 해당 팀, 팀 목록 + +--- + +### 🆕 12. POST/DELETE `/team/:teamId/allowed-names` - 허용 이름 관리 (Level 2) +실제 URL: +- `POST /api/team/:teamId/allowed-names` - 이름 추가 +- `DELETE /api/team/:teamId/allowed-names` - 이름 제거 + +**인증**: 필수 (팀 소유자만) + +**Request (POST)**: +```typescript +{ + name: string; // 추가할 이름 +} +``` + +**Request (DELETE)**: +```typescript +{ + name: string; // 제거할 이름 +} +``` + +**Response**: +```typescript +{ + success: true, + data: { + allowedNames: string[]; // 업데이트된 명단 + } +} +``` + +**참고**: RESTful 원칙에 따라 HTTP Method로 동작 구분 + +**캐시 무효화**: 해당 팀 + +--- + +### 🆕 13. POST/DELETE `/team/:teamId/allowed-emails` - 허용 이메일 관리 (Level 4) +실제 URL: +- `POST /api/team/:teamId/allowed-emails` - 이메일 추가 +- `DELETE /api/team/:teamId/allowed-emails` - 이메일 제거 + +**인증**: 필수 (팀 소유자만) + +**Request (POST)**: +```typescript +{ + email: string; // 추가할 이메일 (소문자로 자동 변환) +} +``` + +**Request (DELETE)**: +```typescript +{ + email: string; // 제거할 이메일 +} +``` + +**Response**: +```typescript +{ + success: true, + data: { + allowedEmails: string[]; // 업데이트된 이메일 목록 + } +} +``` + +**유효성 검사**: 이메일 형식 검증 (`/^[^\s@]+@[^\s@]+\.[^\s@]+$/`) + +**캐시 무효화**: 해당 팀 + +--- + ## User API **중요**: User vs FirestoreUser 구분