From d23319f83768d43f20f0568862d1afd1c01f8bd2 Mon Sep 17 00:00:00 2001 From: forge-bot Date: Tue, 14 Jul 2026 06:31:54 +0000 Subject: [PATCH] =?UTF-8?q?TA=20=EC=97=AD=ED=95=A0=20Spring=20=EA=B2=BD?= =?UTF-8?q?=EA=B3=84=20smoke=20(role-ta-live-1522-001)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runtime/rolematrix/dto/Dtos.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/main/java/com/klaroworks/runtime/rolematrix/dto/Dtos.java diff --git a/src/main/java/com/klaroworks/runtime/rolematrix/dto/Dtos.java b/src/main/java/com/klaroworks/runtime/rolematrix/dto/Dtos.java new file mode 100644 index 0000000..2aa640e --- /dev/null +++ b/src/main/java/com/klaroworks/runtime/rolematrix/dto/Dtos.java @@ -0,0 +1,46 @@ +package com.klaroworks.runtime.rolematrix.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.klaroworks.runtime.rolematrix.domain.RoleMatrix; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; + +import java.time.Instant; +import java.util.List; + +/** 표준 오류 응답 DTO */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public record ErrorResponse( + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss'Z'", timezone = "UTC") Instant timestamp, + int status, String error, String code, String message, String path, String traceId +) { + public static ErrorResponse of(int status, String code, String message, String path, String traceId) { + return new ErrorResponse(Instant.now(), status, resolveErrorName(status), code, message, path, traceId); + } + private static String resolveErrorName(int status) { + return switch (status) { case 400 -> "Bad Request"; case 404 -> "Not Found"; case 409 -> "Conflict"; case 500 -> "Internal Server Error"; default -> "Error"; }; + } +} + +/** 역할 매트릭스 생성 명령 */ +record CreateRoleMatrixCommand( + @NotBlank(message = "역할 매트릭스 이름은 필수입니다") @Size(max = 255) String name, + @Size(max = 1000) String description +) {} + +/** 역할 매트릭스 수정 명령 */ +record UpdateRoleMatrixCommand( + @Size(max = 255) String name, + @Size(max = 1000) String description +) {} + +/** 역할 매트릭스 응답 */ +@JsonInclude(JsonInclude.Include.NON_NULL) +record RoleMatrixResponse( + Long id, String name, String description, List permissionIds, Instant createdAt, Instant updatedAt +) { + public static RoleMatrixResponse from(RoleMatrix entity) { + return new RoleMatrixResponse(entity.getId(), entity.getName(), entity.getDescription(), entity.getPermissionIds(), entity.getCreatedAt(), entity.getUpdatedAt()); + } +}