-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 통합 문서함·파일 업로드·문서 준비도 구현 #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 b3140c3
feat(document): Local FileStorage 구현과 저장 경로 설정 추가
chaeliki 53815ff
refactor(file): document 패키지에서 file 패키지로 이동
chaeliki 03d420e
test(file): 테스트용 FakeFileStorage 추가
chaeliki 33ba966
feat(file): 파일 업로드 응답 DTO 추가
chaeliki efe7fff
feat(file): StoredFileRepository port 추가
chaeliki 6d19223
feat(file): 파일 업로드 Command, Service, 에러코드 추가
chaeliki 0bbebd2
feat(file): POST /files 파일 업로드 API 추가
chaeliki dca98db
feat(file): StoredFile JPA Entity 추가
chaeliki c0fee6c
feat(file): StoredFile JPA Repository 구현
chaeliki f545e4d
feat(file): StoredFile 테이블 migration 추가 (V8)
chaeliki 354d733
fix(file): StoredFile에 task·worker 복합 FK 추가
chaeliki 3e59d22
feat(file): #7 재사용 대비 verified 필드 추가
chaeliki 6b8c060
feat(worker): WorkerDocument에 file_id 연결 기능 추가
chaeliki 2e84df6
feat(worker): WorkerDocument 목록 조회 Repository 추가 (document 패키지 재사용용)
chaeliki a5e00ee
refactor(worker): WorkerRepository 근로자 배치조회 추가 및 count 쿼리 정리
chaeliki 58014dd
feat(document): 통합 문서함 항목 응답 DTO 추가
chaeliki 3144d13
feat(document): 통합 문서함 조회 Service 추가
chaeliki 9839f8a
feat(document): GET /documents 통합 문서함 조회 API 추가
chaeliki 11caa67
feat(document): itemCode-DocumentType 매핑 추가
chaeliki b920a3c
feat(document): 서류 준비도 응답 DTO 추가
chaeliki 7425034
feat(document): 서류 준비도 계산 Service 추가
chaeliki 79e137a
feat(document): GET document-readiness API 추가
chaeliki 6229bfb
feat(document): DocumentRequestDraft 도메인, port, JPA Entity 추가
chaeliki 01bc3d2
feat(document): DocumentRequestDraft JPA Repository 구현
chaeliki 42a3dd0
feat(document): DocumentRequestDraft DTO 및 migration 추가
chaeliki e5421d0
feat(document): DocumentRequestDraft 생성·갱신 Service 추가
chaeliki 8c9f337
feat(document): PUT document-request-draft API 및 taskId 존재 검증 추가
chaeliki 762cc8b
fix(file): 파일 업로드 시 taskId, workerId 존재 검증 추가
chaeliki bab0cea
fix(worker): 서류 등록 시 workerId 존재 검증 추가
chaeliki 5133acd
feat(file): 파일 업로드 감사 로그 연동
chaeliki 1b5ab16
feat(worker): 서류 파일 연결 시 감사 로그 연동
chaeliki 52f1e28
feat(document): 문서 요청 초안 저장 감사 로그 연동
chaeliki 6059c62
fix(file): LocalFileStorage 경로 정규화 버그 수정 및 통합 테스트 추가
chaeliki 5a64b0c
fix(document): DocumentRequestDraft 통합 테스트 정리 순서 수정
chaeliki 72a13f3
fix(document): migration 번호 V11 -> V9로 재조정
chaeliki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,3 +40,7 @@ out/ | |
| .env | ||
| .env.* | ||
| !.env.example | ||
|
|
||
| ### Local file storage ### | ||
| /data/ | ||
| *.log | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
src/main/java/com/fowoco/server/document/api/DocumentController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
103
src/main/java/com/fowoco/server/document/api/DocumentItemResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
| } |
48 changes: 48 additions & 0 deletions
48
src/main/java/com/fowoco/server/document/api/DocumentPageResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
| } |
73 changes: 73 additions & 0 deletions
73
src/main/java/com/fowoco/server/document/api/DocumentReadinessController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() | ||
| ); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.