콘텐츠로 이동

get_suspension_work_notice_upload_token (통지서 사진 업로드 토큰)

작업 중지권 통지서 사진을 Cloudflare R2에 업로드하기 위한 서명 토큰을 발급합니다. 업로드 완료 시 notice.attachment_ids 배열에 자동 추가됩니다.

기본 정보

항목
URL https://asia-northeast3-construction24-test.cloudfunctions.net/get_suspension_work_notice_upload_token
Method POST
인증 Firebase ID Token 필요
권한 현장/장비/회사 멤버

요청

Body

필드 타입 필수 설명
company_id string O 회사 ID
site_id string O 현장 ID
suspension_work_id string O 작업 중지권 ID
file_name string O 원본 파일명
file_size int O 파일 크기(바이트)
file_mime string O MIME 타입 (image/jpeg, image/png 등)

요청 예시

{
  "company_id": "company_123",
  "site_id": "site_456",
  "suspension_work_id": "suspension_abc123",
  "file_name": "notice_01.jpg",
  "file_size": 204800,
  "file_mime": "image/jpeg"
}

응답

성공 (200)

{
  "message": "작업 중지권 업로드 토큰 발급 완료",
  "token": "base64url_encoded_signed_token"
}

실패

코드 message 원인
403 "권한이 없습니다." 현장/장비/회사 멤버가 아님

업로드 흐름

  1. 이 엔드포인트로 토큰 발급
  2. 클라이언트가 받은 토큰으로 Cloudflare Worker 업로드 엔드포인트에 파일 PUT
  3. 업로드 완료 후 Worker가 upload_report 호출 → files 컬렉션에 파일 문서 생성
  4. upload_report가 조건 확인 후 (doc_type=safe, doc_page=realtime-communication, tags.type=notice) suspension_works 문서의 notice.attachment_idsarrayUnion 자동 수행

저장되는 메타

  • doc_type: safe
  • doc_page: realtime-communication
  • tags: {"type": "notice"}
  • related_doc_id: suspension_work_id

참고

  • 전체 스키마: suspension_works 스키마
  • 해제 시점 사진: [[get_suspension_work_end_upload_token]]
  • 보고서 사진: [[get_suspension_work_report_upload_token]]