Skip to content

Commit

Permalink
ADM-692:[backend] feat: valid rework state not blank
Browse files Browse the repository at this point in the history
  • Loading branch information
Liughgood committed Mar 14, 2024
1 parent 5da1086 commit 7a4792f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package heartbeat.controller.board.dto.request;

import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
Expand All @@ -10,7 +12,8 @@
@Setter
@Builder
public class ReworkTimesSetting {

@Valid
@NotBlank(message = "rework state cannot be empty.")
private String reworkState;

private List<String> excludedStates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import heartbeat.service.report.ReportService;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -66,7 +67,7 @@ public ResponseEntity<ReportResponse> generateReport(@PathVariable String report
public ResponseEntity<CallbackResponse> generateReport(
@Schema(type = "string", allowableValues = { "board", "dora" },
accessMode = Schema.AccessMode.READ_ONLY) @PathVariable MetricType metricType,
@RequestBody GenerateReportRequest request) {
@Valid @RequestBody GenerateReportRequest request) {
log.info("Start to generate report_metricType: {}", metricType);
reportService.generateReportByType(request, metricType);
String callbackUrl = "/reports/" + request.getCsvTimeStamp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import heartbeat.util.IdUtil;
import heartbeat.util.MetricsUtil;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -29,6 +30,7 @@ public class GenerateReportRequest {

private List<String> metrics;

@Valid
private JiraBoardSetting jiraBoardSetting;

private BuildKiteSetting buildKiteSetting;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import heartbeat.controller.board.dto.request.RequestJiraBoardColumnSetting;
import heartbeat.controller.board.dto.request.ReworkTimesSetting;
import heartbeat.controller.board.dto.response.TargetField;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand Down Expand Up @@ -40,6 +41,7 @@ public class JiraBoardSetting {

private List<TargetField> overrideFields;

@Valid
private ReworkTimesSetting reworkTimesSetting;

}

0 comments on commit 7a4792f

Please sign in to comment.