TA 역할 Spring 경계 smoke #6

Open
forge-bot wants to merge 9 commits from forge/role-ta-live-1522-001-attempt-2-run-af8c24005cdb into main
Showing only changes of commit d23319f837 - Show all commits

View file

@ -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<String> 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());
}
}