refactor(系统设置): 对部分创建、修改的接口入参增加数据长度的校验

This commit is contained in:
song-tianyang 2024-01-30 20:44:11 +08:00 committed by 刘瑞斌
parent 95a497938c
commit 9e6b60d7a1
12 changed files with 20 additions and 0 deletions

View File

@ -7,6 +7,7 @@ test_plan.module_id.not_blank=测试计划模块ID不能为空
test_plan.parent_id.length_range=测试计划父id长度过长
test_plan.parent_id.not_blank=测试计划父id不能为空
test_plan.name.length_range=测试计划名称长度过长
test_plan_module.name.length_range=测试计划模块名称长度过长
test_plan.name.not_blank=测试计划名称不能为空
test_plan.name.exist=测试计划名称已存在
test_plan.too_many=测试计划数量不能超过{0}个

View File

@ -7,6 +7,7 @@ test_plan.module_id.not_blank=Test plan module id cannot be empty
test_plan.parent_id.length_range=Test plan parent id length too long
test_plan.parent_id.not_blank=Test plan parent id cannot be empty
test_plan.name.length_range=Test plan name length too long
test_plan_module.name.length_range=Test plan module name length too long
test_plan.name.not_blank=Test plan name cannot be empty
test_plan.name.exist=Test plan name exist
test_plan.too_many=Test plan cannot larger than {0}

View File

@ -7,6 +7,7 @@ test_plan.module_id.not_blank=测试计划模块ID不能为空
test_plan.parent_id.length_range=测试计划父id长度过长
test_plan.parent_id.not_blank=测试计划父id不能为空
test_plan.name.length_range=测试计划名称长度过长
test_plan_module.name.length_range=测试计划模块名称长度过长
test_plan.name.not_blank=测试计划名称不能为空
test_plan.name.exist=测试计划名称已存在
test_plan.too_many=测试计划数量不能超过{0}个

View File

@ -7,6 +7,7 @@ test_plan.module_id.not_blank=測試計劃模塊ID不能為空
test_plan.parent_id.length_range=測試計劃父id長度過長
test_plan.parent_id.not_blank=測試計劃父id不能為空
test_plan.name.length_range=測試計劃名稱長度過長
test_plan_module.name.length_range=測試計劃模塊名稱長度過長
test_plan.name.not_blank=測試計劃名稱不能為空
test_plan.name.exist=測試計劃名稱已存在
test_plan.not.exist=測試計劃不存在

View File

@ -4,6 +4,7 @@ import io.metersphere.sdk.constants.ModuleConstants;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
@ -14,6 +15,7 @@ public class FileModuleCreateRequest {
@Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "{file_module.name.not_blank}")
@Size(min = 1, max = 255, message = "{file_module.name.length_range}")
private String name;
@Schema(description = "父模块ID", requiredMode = Schema.RequiredMode.REQUIRED)

View File

@ -3,6 +3,7 @@ package io.metersphere.project.dto.filemanagement.request;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
@ -13,6 +14,7 @@ public class FileModuleUpdateRequest {
@Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "{file_module.name.not_blank}")
@Size(min = 1, max = 255, message = "{file_module.name.length_range}")
private String name;
}

View File

@ -3,6 +3,7 @@ package io.metersphere.project.dto.filemanagement.request;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
@ -13,6 +14,7 @@ public class FileRepositoryCreateRequest {
@Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{file_repository.name.not_blank}")
@Size(min = 1, max = 255, message = "{file_module.name.length_range}")
private String name;
@Schema(description = "存储库类型", requiredMode = Schema.RequiredMode.REQUIRED)

View File

@ -2,6 +2,7 @@ package io.metersphere.project.dto.filemanagement.request;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
@ -11,6 +12,7 @@ public class FileRepositoryUpdateRequest {
private String id;
@Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(min = 1, max = 255, message = "{file_module.name.length_range}")
private String name;
@Schema(description = "存储库类型", requiredMode = Schema.RequiredMode.REQUIRED)

View File

@ -2,6 +2,7 @@ package io.metersphere.project.dto.filemanagement.request;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.util.ArrayList;
@ -15,6 +16,7 @@ public class FileUpdateRequest {
private String id;
@Schema(description = "文件名称")
@Size(min = 1, max = 255, message = "{file_metadata.name.length_range}")
private String name;
// tags内的数据确保不重复且有序所以使用这个数据结构接受

View File

@ -4,6 +4,7 @@ import io.metersphere.sdk.constants.ModuleConstants;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
@ -14,6 +15,7 @@ public class TestPlanModuleCreateRequest {
@Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "{module.name.not_blank}")
@Size(min = 1, max = 255, message = "{test_plan_module.name.length_range}")
private String name;
@Schema(description = "父模块ID", requiredMode = Schema.RequiredMode.REQUIRED)

View File

@ -3,6 +3,7 @@ package io.metersphere.plan.dto.request;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
@ -13,6 +14,7 @@ public class TestPlanModuleUpdateRequest {
@Schema(description = "模块名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "{module.name.not_blank}")
@Size(min = 1, max = 255, message = "{test_plan_module.name.length_range}")
private String name;
}

View File

@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.util.LinkedHashSet;
@ -15,6 +16,7 @@ public class TestPlanUpdateRequest {
private String id;
@Schema(description = "测试计划名称")
@Size(min = 1, max = 255, message = "{test_plan.name.length_range}")
private String name;
@Schema(description = "模块ID")