Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b7e8fd0
feat(document): StoredFile 도메인과 FileStorage port 추가
chaeliki Jul 26, 2026
b3140c3
feat(document): Local FileStorage 구현과 저장 경로 설정 추가
chaeliki Jul 26, 2026
53815ff
refactor(file): document 패키지에서 file 패키지로 이동
chaeliki Jul 26, 2026
03d420e
test(file): 테스트용 FakeFileStorage 추가
chaeliki Jul 26, 2026
33ba966
feat(file): 파일 업로드 응답 DTO 추가
chaeliki Jul 26, 2026
efe7fff
feat(file): StoredFileRepository port 추가
chaeliki Jul 26, 2026
6d19223
feat(file): 파일 업로드 Command, Service, 에러코드 추가
chaeliki Jul 26, 2026
0bbebd2
feat(file): POST /files 파일 업로드 API 추가
chaeliki Jul 26, 2026
dca98db
feat(file): StoredFile JPA Entity 추가
chaeliki Jul 26, 2026
c0fee6c
feat(file): StoredFile JPA Repository 구현
chaeliki Jul 26, 2026
f545e4d
feat(file): StoredFile 테이블 migration 추가 (V8)
chaeliki Jul 26, 2026
354d733
fix(file): StoredFile에 task·worker 복합 FK 추가
chaeliki Jul 26, 2026
3e59d22
feat(file): #7 재사용 대비 verified 필드 추가
chaeliki Jul 26, 2026
6b8c060
feat(worker): WorkerDocument에 file_id 연결 기능 추가
chaeliki Jul 27, 2026
2e84df6
feat(worker): WorkerDocument 목록 조회 Repository 추가 (document 패키지 재사용용)
chaeliki Jul 27, 2026
a5e00ee
refactor(worker): WorkerRepository 근로자 배치조회 추가 및 count 쿼리 정리
chaeliki Jul 27, 2026
58014dd
feat(document): 통합 문서함 항목 응답 DTO 추가
chaeliki Jul 27, 2026
3144d13
feat(document): 통합 문서함 조회 Service 추가
chaeliki Jul 27, 2026
9839f8a
feat(document): GET /documents 통합 문서함 조회 API 추가
chaeliki Jul 27, 2026
11caa67
feat(document): itemCode-DocumentType 매핑 추가
chaeliki Jul 27, 2026
b920a3c
feat(document): 서류 준비도 응답 DTO 추가
chaeliki Jul 27, 2026
7425034
feat(document): 서류 준비도 계산 Service 추가
chaeliki Jul 27, 2026
79e137a
feat(document): GET document-readiness API 추가
chaeliki Jul 27, 2026
6229bfb
feat(document): DocumentRequestDraft 도메인, port, JPA Entity 추가
chaeliki Jul 27, 2026
01bc3d2
feat(document): DocumentRequestDraft JPA Repository 구현
chaeliki Jul 27, 2026
42a3dd0
feat(document): DocumentRequestDraft DTO 및 migration 추가
chaeliki Jul 27, 2026
e5421d0
feat(document): DocumentRequestDraft 생성·갱신 Service 추가
chaeliki Jul 27, 2026
8c9f337
feat(document): PUT document-request-draft API 및 taskId 존재 검증 추가
chaeliki Jul 27, 2026
762cc8b
fix(file): 파일 업로드 시 taskId, workerId 존재 검증 추가
chaeliki Jul 27, 2026
bab0cea
fix(worker): 서류 등록 시 workerId 존재 검증 추가
chaeliki Jul 28, 2026
5133acd
feat(file): 파일 업로드 감사 로그 연동
chaeliki Jul 28, 2026
1b5ab16
feat(worker): 서류 파일 연결 시 감사 로그 연동
chaeliki Jul 28, 2026
52f1e28
feat(document): 문서 요청 초안 저장 감사 로그 연동
chaeliki Jul 28, 2026
6059c62
fix(file): LocalFileStorage 경로 정규화 버그 수정 및 통합 테스트 추가
chaeliki Jul 28, 2026
5a64b0c
fix(document): DocumentRequestDraft 통합 테스트 정리 순서 수정
chaeliki Jul 28, 2026
72a13f3
fix(document): migration 번호 V11 -> V9로 재조정
chaeliki Jul 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ out/
.env
.env.*
!.env.example

### Local file storage ###
/data/
Comment thread
chaeliki marked this conversation as resolved.
*.log
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ public enum AuditAction {
APPROVAL_INVALIDATED,
EXTERNAL_SUBMISSION_RECORDED,
EVIDENCE_RECORDED,
TASK_COMPLETED
TASK_COMPLETED,
FILE_UPLOADED,
WORKER_DOCUMENT_FILE_LINKED,
DOCUMENT_REQUEST_DRAFT_SAVED
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ public enum AuditTargetType {
TASK,
APPROVAL_REQUEST,
EXTERNAL_SUBMISSION,
EVIDENCE
EVIDENCE,
FILE,
WORKER_DOCUMENT,
DOCUMENT_REQUEST_DRAFT
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package com.fowoco.server.document.api;

import com.fowoco.server.auth.application.port.ActorContextProvider;
import com.fowoco.server.document.application.DocumentPageResult;
import com.fowoco.server.document.application.DocumentService;
import com.fowoco.server.worker.application.WorkerDocumentSearchQuery;
import com.fowoco.server.worker.domain.DocumentType;
import com.fowoco.server.worker.domain.SubmissionStatus;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import java.time.LocalDate;
import java.util.List;
import java.util.UUID;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "Document", description = "사업장 통합 문서함 조회")
@RestController
@RequestMapping("/api/v1/documents")
@SecurityRequirement(name = "bearerAuth")
@Validated
public class DocumentController {

private final DocumentService documentService;
private final ActorContextProvider actorContextProvider;

public DocumentController(
DocumentService documentService,
ActorContextProvider actorContextProvider
) {
this.documentService = documentService;
this.actorContextProvider = actorContextProvider;
}

@Operation(
operationId = "listDocuments",
summary = "통합 문서함 조회",
description = "근로자·업무·문서 유형·상태로 사업장 전체 서류를 검색합니다. "
)
@ApiResponses({
@ApiResponse(
responseCode = "200",
description = "조회 성공",
content = @Content(
mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = DocumentPageResponse.class)
)
),
@ApiResponse(responseCode = "400", ref = "#/components/responses/BadRequest"),
@ApiResponse(responseCode = "401", ref = "#/components/responses/Unauthorized"),
@ApiResponse(responseCode = "403", ref = "#/components/responses/Forbidden")
})
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasAnyRole('ADMIN', 'HR', 'VIEWER')")
public DocumentPageResponse list(
@Parameter(description = "근로자 ID 필터") @RequestParam(required = false) UUID workerId,
@Parameter(description = "서류 유형 필터") @RequestParam(required = false) DocumentType documentType,
@Parameter(description = "제출 상태 필터") @RequestParam(required = false) SubmissionStatus status,
@Parameter(description = "이 날짜 이전 만료 필터") @RequestParam(required = false) LocalDate expiryBefore,
@Parameter(description = "페이지 번호 (0부터 시작)")
@RequestParam(defaultValue = "0") @Min(0) int page,
@Parameter(description = "페이지당 항목 수 (1~100)")
@RequestParam(defaultValue = "20") @Min(1) @Max(100) int size
) {
UUID companyId = actorContextProvider.requireCurrentActor().companyId();
WorkerDocumentSearchQuery query = new WorkerDocumentSearchQuery(
workerId,
documentType,
status,
expiryBefore,
page,
size
);
DocumentPageResult result = documentService.findPage(companyId, query);
List<DocumentItemResponse> items = result.items().stream()
.map(document -> DocumentItemResponse.from(
document,
result.workerDisplayNames().get(document.workerId())
))
.toList();
return new DocumentPageResponse(items, result.page(), result.size(), result.totalElements());
}
}
103 changes: 103 additions & 0 deletions src/main/java/com/fowoco/server/document/api/DocumentItemResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package com.fowoco.server.document.api;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fowoco.server.worker.domain.DocumentType;
import com.fowoco.server.worker.domain.SubmissionStatus;
import com.fowoco.server.worker.domain.WorkerDocument;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDate;
import java.util.UUID;

@Schema(name = "DocumentItemResponse", description = "통합 문서함의 서류 항목 (근로자 표시 정보 포함)")
public final class DocumentItemResponse {

@JsonProperty("worker_document_id")
@Schema(name = "worker_document_id", format = "uuid", requiredMode = Schema.RequiredMode.REQUIRED)
private final UUID workerDocumentId;

@JsonProperty("worker_id")
@Schema(name = "worker_id", format = "uuid", requiredMode = Schema.RequiredMode.REQUIRED)
private final UUID workerId;

@JsonProperty("display_name")
@Schema(
name = "display_name",
description = "근로자 화면 표시 이름. 근로자가 조회 시점에 삭제된 경우 null.",
requiredMode = Schema.RequiredMode.REQUIRED
)
private final String displayName;

@JsonProperty("document_type")
@Schema(name = "document_type", requiredMode = Schema.RequiredMode.REQUIRED)
private final DocumentType documentType;

@JsonProperty("submission_status")
@Schema(name = "submission_status", requiredMode = Schema.RequiredMode.REQUIRED)
private final SubmissionStatus submissionStatus;

@JsonProperty("expiry_date")
@Schema(name = "expiry_date", format = "date")
private final LocalDate expiryDate;

@JsonProperty("file_id")
@Schema(name = "file_id", format = "uuid")
private final UUID fileId;

private DocumentItemResponse(
UUID workerDocumentId,
UUID workerId,
String displayName,
DocumentType documentType,
SubmissionStatus submissionStatus,
LocalDate expiryDate,
UUID fileId
) {
this.workerDocumentId = workerDocumentId;
this.workerId = workerId;
this.displayName = displayName;
this.documentType = documentType;
this.submissionStatus = submissionStatus;
this.expiryDate = expiryDate;
this.fileId = fileId;
}

public static DocumentItemResponse from(WorkerDocument document, String displayName) {
return new DocumentItemResponse(
document.workerDocumentId(),
document.workerId(),
displayName,
document.documentType(),
document.submissionStatus(),
document.expiryDate(),
document.fileId()
);
}

public UUID getWorkerDocumentId() {
return workerDocumentId;
}

public UUID getWorkerId() {
return workerId;
}

public String getWorkerDisplayName() {
return displayName;
}

public DocumentType getDocumentType() {
return documentType;
}

public SubmissionStatus getSubmissionStatus() {
return submissionStatus;
}

public LocalDate getExpiryDate() {
return expiryDate;
}

public UUID getFileId() {
return fileId;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.fowoco.server.document.api;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;

@Schema(name = "DocumentPageResponse", description = "사업장 통합 문서함 목록 페이지 응답")
public final class DocumentPageResponse {

@JsonProperty("items")
@Schema(description = "이번 페이지의 서류 목록", requiredMode = Schema.RequiredMode.REQUIRED)
private final List<DocumentItemResponse> items;

@JsonProperty("page")
@Schema(description = "현재 페이지 번호 (0부터 시작)", example = "0", requiredMode = Schema.RequiredMode.REQUIRED)
private final int page;

@JsonProperty("size")
@Schema(description = "페이지당 항목 수", example = "20", requiredMode = Schema.RequiredMode.REQUIRED)
private final int size;

@JsonProperty("total_elements")
@Schema(name = "total_elements", description = "전체 서류 수", example = "42", requiredMode = Schema.RequiredMode.REQUIRED)
private final long totalElements;

public DocumentPageResponse(List<DocumentItemResponse> items, int page, int size, long totalElements) {
this.items = items;
this.page = page;
this.size = size;
this.totalElements = totalElements;
}

public List<DocumentItemResponse> getItems() {
return items;
}

public int getPage() {
return page;
}

public int getSize() {
return size;
}

public long getTotalElements() {
return totalElements;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.fowoco.server.document.api;

import com.fowoco.server.auth.application.port.ActorContextProvider;
import com.fowoco.server.document.application.DocumentReadinessResult;
import com.fowoco.server.document.application.DocumentReadinessService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.UUID;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "Document", description = "사업장 통합 문서함 조회")
@RestController
@RequestMapping("/api/v1/tasks/{taskId}/document-readiness")
@SecurityRequirement(name = "bearerAuth")
public class DocumentReadinessController {

private final DocumentReadinessService documentReadinessService;
private final ActorContextProvider actorContextProvider;

public DocumentReadinessController(
DocumentReadinessService documentReadinessService,
ActorContextProvider actorContextProvider
) {
this.documentReadinessService = documentReadinessService;
this.actorContextProvider = actorContextProvider;
}

@Operation(
operationId = "getDocumentReadiness",
summary = "업무별 서류 준비도 확인",
description = "Task 생성 시 고정된 체크리스트 snapshot을 기준으로 현재 업무에 필요한 "
+ "서류가 준비됐는지 확인합니다. Workflow Catalog를 실시간으로 다시 읽지 않습니다."
)
@ApiResponses({
@ApiResponse(
responseCode = "200",
description = "조회 성공",
content = @Content(
mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = DocumentReadinessResponse.class)
)
),
@ApiResponse(responseCode = "401", ref = "#/components/responses/Unauthorized"),
@ApiResponse(responseCode = "403", ref = "#/components/responses/Forbidden"),
@ApiResponse(responseCode = "404", ref = "#/components/responses/NotFound")
})
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("hasAnyRole('ADMIN', 'HR', 'VIEWER')")
public DocumentReadinessResponse get(
@Parameter(description = "업무 ID") @PathVariable UUID taskId
) {
UUID companyId = actorContextProvider.requireCurrentActor().companyId();
DocumentReadinessResult result = documentReadinessService.calculate(taskId, companyId);
return new DocumentReadinessResponse(
result.required(),
result.available(),
result.missing(),
result.expired(),
result.completionBlocked()
);
}
}
Loading
Loading