콘텐츠로 이동

create_drive_folder (드라이브 폴더 생성)

현장 드라이브에 새 폴더를 생성합니다.

기본 정보

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

요청

Body

필드 타입 필수 설명 검증
token string O Firebase ID Token -
company_id string O 회사 ID -
site_id string O 현장 ID -
category string O 최상위 카테고리 affairs, construction, management, safety, etc
name string O 폴더 이름 1~50자
parent_folder_id string | null O 상위 폴더 ID null이면 카테고리 바로 아래

요청 예시

{
  "token": "eyJhbGci...",
  "company_id": "company_abc",
  "site_id": "site_123",
  "category": "construction",
  "name": "골조 공사",
  "parent_folder_id": null
}

하위 폴더 생성 예시

{
  "token": "eyJhbGci...",
  "company_id": "company_abc",
  "site_id": "site_123",
  "category": "construction",
  "name": "1층 골조",
  "parent_folder_id": "folder_abc123"
}

응답

성공 (200)

{
  "message": "폴더가 생성되었습니다.",
  "folder_id": "생성된 폴더 ID"
}

실패

코드 message 원인
400 "필드 'category'은(는) [...] 중 하나여야 합니다." 유효하지 않은 카테고리
400 "상위 폴더의 카테고리와 일치하지 않습니다." 상위 폴더와 다른 카테고리
403 "권한이 없습니다." 회사/현장 접근 권한 없음
404 "상위 폴더를 찾을 수 없습니다." 존재하지 않는 parent_folder_id

참고

  • 최상위 카테고리: 공무(affairs), 공사(construction), 관리(management), 안전(safety), 기타(etc) 5개 고정
  • 최상위 카테고리는 Firestore 문서로 존재하지 않고, category 필드가 가상의 최상위 폴더 역할
  • parent_folder_id: null → 해당 카테고리의 1depth 폴더
  • 관련 API: rename_drive_folder, delete_drive_folder