콘텐츠로 이동

suspension_works 스키마

작업 중지권 문서의 전체 스키마. 각 엔드포인트 문서에서 참조용으로 사용합니다.

저장 위치

companies/{company_id}/sites/{site_id}/suspension_works/{suspension_work_id}

상태 흐름

pending → suspended → ended
pending → rejected
  • pending: 근로자 요청 후 승인 대기 (admin_suspension_work는 pending 스킵)
  • suspended: 승인되어 작업 중지 진행 중
  • rejected: 거절됨 (종료 상태)
  • ended: 작업 중지 해제됨

문서 필드

필드 타입 설명
status string "pending" | "suspended" | "rejected" | "ended"
display_title string 리스트뷰/알림 표시용 제목 (현재 유효한 title)
display_body string 리스트뷰 표시용 본문
requester object 최초 요청자 (불변) — 아래 Actor 참조
notice object 공지 본문 — 아래 Notice 참조
decision object? 승인/거절 결정 (status=pending이면 없음) — 아래 Decision 참조
ending object? 해제 정보 (status=ended만) — 아래 Ending 참조
report object? 조치완료 보고서 (선택) — 아래 Report 참조

Actor

액터(요청자/승인자/종료자 등)를 나타내는 공통 서브오브젝트.

필드 타입 설명
uid string 사용자 UID
name string 당시 멤버 이름
at timestamp 해당 액션 발생 시각

Notice

{
  "title": "A동 3층 작업 중지",
  "body": "추락 위험 발견",
  "attachment_ids": ["file_doc_id_1", "file_doc_id_2"],
  "updated_at": "timestamp (edit_suspension_notice 호출 시만)",
  "updated_by": "uid",
  "updated_by_name": "이름"
}
필드 타입 설명
title string 공지 제목 (승인 시 수정 가능)
body string 공지 본문 (승인 시 수정 가능)
attachment_ids string[] 통지서 첨부파일 (files 컬렉션의 doc_id 배열, tags.type=notice)
updated_at timestamp? edit_suspension_notice로 수정 시 기록
updated_by string? 수정자 UID
updated_by_name string? 수정자 이름

Decision

{
  "type": "approved",
  "actor": { "uid": "...", "name": "...", "at": "..." },
  "title": "...",
  "body": "...",
  "reply": null
}
필드 타입 설명
type string "approved" | "rejected"
actor Actor 결정자 정보
title string 승인/거절 시점의 제목 (거절이면 원본 title)
body string 승인/거절 시점의 본문
reply string? 거절 사유 (승인 시 null)

Ending

{
  "actor": { "uid": "...", "name": "...", "at": "..." },
  "message": "안전 조치 완료 후 작업 재개",
  "attachment_ids": ["file_doc_id_1"]
}
필드 타입 설명
actor Actor 해제한 사람
message string 해제 메시지 (이전 action_body와 동일 의미)
attachment_ids string[] 해제 시 첨부된 파일 (tags.type=end)

Report

{
  "title": "조치 완료 보고",
  "body": "조치 상세...",
  "created": { "uid": "...", "name": "...", "at": "..." },
  "updated": { "uid": "...", "name": "...", "at": "..." } ,
  "attachment_ids": ["file_doc_id_1"]
}
필드 타입 설명
title string 보고서 제목
body string 보고서 본문
created Actor 보고서 최초 작성자
updated Actor? 마지막 수정자 (수정 시에만)
attachment_ids string[] 보고서 첨부파일 (tags.type=report)

첨부파일 (files) 연결

첨부파일 원본 메타는 companies/{cid}/sites/{sid}/files/ 컬렉션에 저장되며, related_doc_id == suspension_work_id로 연결됩니다. 파일의 tags.type 값(notice / end / report)으로 각 stage 분류.

업로드 완료 시(upload_report) 해당 stage의 attachment_ids 배열에 file_doc_id가 자동 추가됩니다.

예시 문서 (ended + report 상태)

{
  "status": "ended",
  "display_title": "A동 3층 작업 중지",
  "display_body": "추락 위험 발견",
  "requester": {
    "uid": "uid_worker",
    "name": "홍길동",
    "at": "2026-04-20T10:00:00Z"
  },
  "notice": {
    "title": "A동 3층 작업 중지",
    "body": "추락 위험 발견",
    "attachment_ids": ["file_1", "file_2"]
  },
  "decision": {
    "type": "approved",
    "actor": { "uid": "uid_admin", "name": "김관리자", "at": "2026-04-20T10:30:00Z" },
    "title": "A동 3층 작업 중지",
    "body": "추락 위험 확인",
    "reply": null
  },
  "ending": {
    "actor": { "uid": "uid_admin", "name": "김관리자", "at": "2026-04-20T12:00:00Z" },
    "message": "안전난간 설치 완료 후 작업 재개",
    "attachment_ids": ["file_3"]
  },
  "report": {
    "title": "조치 완료 보고",
    "body": "안전난간 설치 및 안전교육 실시",
    "created": { "uid": "uid_admin", "name": "김관리자", "at": "2026-04-20T12:30:00Z" },
    "updated": null,
    "attachment_ids": ["file_4"]
  }
}