Skip to content

feat: WorkerDetailPage에 근로자 서류 등록 + 파일 업로드 실연동 - #228

Merged
BcKmini merged 1 commit into
mainfrom
feature/227-worker-document-register
Aug 3, 2026
Merged

feat: WorkerDetailPage에 근로자 서류 등록 + 파일 업로드 실연동#228
BcKmini merged 1 commit into
mainfrom
feature/227-worker-document-register

Conversation

@BcKmini

@BcKmini BcKmini commented Aug 3, 2026

Copy link
Copy Markdown
Member

배경

서버에 이미 구현돼 있지만 클라이언트가 안 쓰던 API 2개를 연결:

  • POST /api/v1/files — 파일 업로드 (image/jpeg·png·webp, application/pdf, 최대 20MB)
  • POST/PATCH /api/v1/workers/{workerId}/documents(/{documentId}) — 서류 상태 등록/수정

DocumentListPageFileUploadModal(HWP/HWPX 전용)은 서버가 지원 안 하는 형식이라 그대로 연결 불가 — 대신 서버가 실제 지원하는 image/PDF 업로드 흐름을 WorkerDetailPage에 새로 붙였다.

변경 사항

  • src/api/files.ts 신규: uploadFile()
  • src/api/documents.ts: registerWorkerDocument(), patchWorkerDocument(), WorkerDocumentResponse 추가
  • src/api/client.ts: apiFetch가 body 존재 시 무조건 Content-Type: application/json을 강제하던 걸, FormData면 건너뛰도록 수정 (브라우저가 자동으로 올바른 multipart boundary 헤더를 설정하게 함)
  • WorkerDetailPage의 "서류" 카드에 "+ 서류 등록" 버튼 + RegisterDocumentModal 추가 — 서류 유형/제출 상태/유효기간/파일 첨부(선택) 입력
  • 파일이 있으면 업로드(file_id 발급) → 서류 등록 → 등록 응답의 version으로 PATCH하여 file_id 연결까지 3단계로 처리 (등록 API는 생성 시점에 file_id를 받지 않음)

스코프 제외

  • DocumentDetailPage의 확인/반려 액션은 여전히 데모 — GET /documents 목록에 version이 없고 단건 조회도 없어 기존 문서의 expected_version을 알 방법이 없음([Screen] 티켓 관리 화면 신규 설계 및 구현 (/tickets) #57, 이번 PR로 해결 안 됨)
  • HWP/HWPX 업로드는 서버가 지원하지 않아 그대로 데모 유지

검증

  • npm run lint
  • npx vitest run (343 tests passed)
  • npm run build
  • 브라우저 확장 미연결로 실기동 스모크 테스트는 못 함 — 자동화 테스트로만 검증

Closes #227

fowoco/server를 다시 훑어보니 POST /api/v1/files(FileController), POST/PATCH
/workers/{id}/documents(WorkerDocumentController)가 이미 구현돼 있는데 클라이언트가
전혀 안 쓰고 있었다. DocumentListPage의 FileUploadModal(HWP/HWPX 전용)은 서버가
지원 안 하는 형식이라 그대로 못 붙이고, 대신 서버가 실제 지원하는 image/PDF
업로드 + 서류 등록 흐름을 WorkerDetailPage에 새로 붙였다.

등록 API는 생성 시점에 file_id를 안 받아서, 파일이 있으면 업로드 → 등록 →
등록 응답의 version으로 PATCH해서 file_id를 연결하는 3단계로 처리한다.
client.ts의 apiFetch가 body 존재 시 무조건 Content-Type: application/json을
강제하던 걸 FormData는 건너뛰도록 고쳐서 multipart 업로드가 가능해지게 했다.

DocumentDetailPage의 확인/반려(PATCH)는 여전히 데모 상태 — 목록 API에 version이
없어 기존 문서의 expected_version을 알 방법이 없는 문제는 이번 스코프 밖(#57).

Closes #227
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WorkerDetailPage에 근로자 서류 등록 + 파일 업로드 실연동

1 participant