docs: CURRENT_WORKS.md 업데이트 - 시스템 게시판 tenant_id 수정 작업 기록
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,99 @@
|
||||
# SAM API 작업 현황
|
||||
|
||||
## 2025-12-28 (토) - 시스템 게시판 tenant_id 및 custom_fields 수정
|
||||
|
||||
### 작업 목표
|
||||
- POST `/api/v1/system-boards/qna/posts` 500 에러 해결
|
||||
- 시스템 게시판 tenant_id 처리 로직 개선
|
||||
- custom_fields field_key → field_id 매핑 지원
|
||||
- 댓글 생성 시 tenant_id 누락 수정
|
||||
|
||||
### 문제 원인
|
||||
1. `posts.tenant_id` NOT NULL 제약조건 위반 (시스템 게시판에서 null 설정 시도)
|
||||
2. `saveCustomFields()`에서 field_key(string)를 field_id(integer)로 사용
|
||||
3. `createComment()`에서 tenant_id 미설정
|
||||
|
||||
### 수정된 파일 (1개)
|
||||
|
||||
| 파일명 | 변경 내용 |
|
||||
|--------|----------|
|
||||
| `app/Services/Boards/PostService.php` | tenant_id 항상 설정, custom_fields 매핑 개선, 댓글 tenant_id 추가 |
|
||||
|
||||
### 상세 변경사항
|
||||
|
||||
#### 1. HQ_TENANT_ID 상수 추가
|
||||
```php
|
||||
private const HQ_TENANT_ID = 1; // 본사 테넌트 ID
|
||||
```
|
||||
|
||||
#### 2. applySystemBoardScope() 헬퍼 메서드 추가
|
||||
```php
|
||||
private function applySystemBoardScope($query): void
|
||||
{
|
||||
$query->where(function ($q) {
|
||||
$q->where('tenant_id', self::HQ_TENANT_ID)
|
||||
->orWhere('tenant_id', $this->tenantId());
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
#### 3. createPost() 수정
|
||||
- 변경 전: `$data['tenant_id'] = $isSystemBoard ? null : $this->tenantId();`
|
||||
- 변경 후: `$data['tenant_id'] = $this->tenantId();` (항상 설정)
|
||||
|
||||
#### 4. saveCustomFields() 개선
|
||||
- boardId 파라미터 추가
|
||||
- field_key → field_id 매핑 로직 추가 (BoardSetting 조회)
|
||||
- 모든 호출부 업데이트 (createPost, updatePost 등)
|
||||
|
||||
#### 5. createComment() 수정
|
||||
- `$data['tenant_id'] = $this->tenantId();` 추가
|
||||
|
||||
### 시스템 게시판 조회 조건
|
||||
```
|
||||
(tenant_id = 1) OR (tenant_id = 현재 테넌트)
|
||||
```
|
||||
- 본사(tenant_id=1)의 글: 모든 테넌트에서 조회 가능
|
||||
- 각 테넌트 글: 해당 테넌트만 조회 가능
|
||||
|
||||
### 테스트 결과
|
||||
- ✅ 게시글 생성 (id=7, id=8 with custom_fields)
|
||||
- ✅ custom_fields 저장 (inquiry_type → field_id=2 변환)
|
||||
- ✅ 댓글 생성 (id=1, tenant_id=1)
|
||||
|
||||
### Git 커밋
|
||||
```
|
||||
4a2c185 fix: 게시판 시스템 tenant_id 및 custom_fields 처리 개선
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2025-12-27 (금) - 결재 API 프론트엔드 호환성 개선
|
||||
|
||||
### 작업 목표
|
||||
- 프론트엔드에서 `form_code`, `step_type`, `approver_id` 필드명 사용 지원
|
||||
- 기존 `form_id`, `type`, `user_id` 필드명과 호환성 유지
|
||||
|
||||
### 수정된 파일 (4개)
|
||||
|
||||
| 파일명 | 변경 내용 |
|
||||
|--------|----------|
|
||||
| `app/Http/Requests/Approval/StoreRequest.php` | form_code, step_type, approver_id 필드 추가 |
|
||||
| `app/Http/Requests/Approval/UpdateRequest.php` | form_code, steps 필드 지원 추가 |
|
||||
| `app/Services/ApprovalService.php` | store()/update() - form_code→form_id 변환, createApprovalSteps() - step_type/approver_id 지원 |
|
||||
| `lang/ko/error.php` | `approval.form_required` 에러 메시지 추가 |
|
||||
|
||||
### 필드 호환성 매핑
|
||||
|
||||
| 프론트엔드 | API (이전) | 설명 |
|
||||
|-----------|-----------|------|
|
||||
| `form_code` | `form_id` | 양식 코드로 form_id 자동 조회 |
|
||||
| `step_type` | `type` | 결재/참조 구분 |
|
||||
| `approver_id` | `user_id` | 결재자 사용자 ID |
|
||||
| `step_order` | - | 결재 순서 (자동 증가) |
|
||||
|
||||
---
|
||||
|
||||
## 2025-12-26 (목) - 휴가관리 휴직 직원 표시 수정
|
||||
|
||||
### 작업 목표
|
||||
|
||||
Reference in New Issue
Block a user