feat(文件管理): 调用文件修改接口时确保标签不会重复
This commit is contained in:
parent
8dcef99e4d
commit
d0ba083172
|
@ -4,7 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
@Data
|
||||
public class FileUpdateRequest {
|
||||
|
@ -15,8 +15,9 @@ public class FileUpdateRequest {
|
|||
@Schema(description = "文件名称")
|
||||
private String name;
|
||||
|
||||
//注: tags内的数据确保不重复且有序。所以使用这个数据结构接受
|
||||
@Schema(description = "标签")
|
||||
private List<
|
||||
private LinkedHashSet<
|
||||
@NotBlank
|
||||
String> tags;
|
||||
|
||||
|
|
|
@ -975,7 +975,7 @@ public class FileManagementControllerTests extends BaseTest {
|
|||
FileUpdateRequest updateRequest = new FileUpdateRequest();
|
||||
updateRequest.setId(updateFileId);
|
||||
updateRequest.setName("update_" + updateFileId);
|
||||
updateRequest.setTags(new ArrayList<>() {{
|
||||
updateRequest.setTags(new LinkedHashSet<>() {{
|
||||
this.add("tag1");
|
||||
}});
|
||||
updateRequest.setDescription("updateDesc_" + updateFileId);
|
||||
|
@ -997,7 +997,7 @@ public class FileManagementControllerTests extends BaseTest {
|
|||
oldFileMetadata = fileMetadataMapper.selectByPrimaryKey(updateFileId);
|
||||
updateRequest = new FileUpdateRequest();
|
||||
updateRequest.setId(updateFileId);
|
||||
updateRequest.setTags(new ArrayList<>());
|
||||
updateRequest.setTags(new LinkedHashSet<>());
|
||||
this.requestPostWithOk(FileManagementRequestUtils.URL_FILE_UPDATE, updateRequest);
|
||||
this.checkFileInformation(updateFileId, oldFileMetadata, updateRequest);
|
||||
|
||||
|
@ -1013,7 +1013,7 @@ public class FileManagementControllerTests extends BaseTest {
|
|||
oldFileMetadata = fileMetadataMapper.selectByPrimaryKey(updateFileId);
|
||||
updateRequest = new FileUpdateRequest();
|
||||
updateRequest.setId(updateFileId);
|
||||
updateRequest.setTags(new ArrayList<>());
|
||||
updateRequest.setTags(new LinkedHashSet<>());
|
||||
this.requestPostWithOk(FileManagementRequestUtils.URL_FILE_UPDATE, updateRequest);
|
||||
this.checkFileInformation(updateFileId, oldFileMetadata, updateRequest);
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.springframework.util.LinkedMultiValueMap;
|
|||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Objects;
|
||||
|
||||
@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
|
@ -121,7 +122,7 @@ public class FileManagementPermissionControllerTests extends BaseTest {
|
|||
FileUpdateRequest updateRequest = new FileUpdateRequest();
|
||||
updateRequest.setId(TEST_ID);
|
||||
updateRequest.setName("update_" + TEST_ID);
|
||||
updateRequest.setTags(new ArrayList<>() {{
|
||||
updateRequest.setTags(new LinkedHashSet<>() {{
|
||||
this.add("tag1");
|
||||
}});
|
||||
this.requestPostPermissionTest(PermissionConstants.PROJECT_FILE_MANAGEMENT_READ_UPDATE, FileManagementRequestUtils.URL_FILE_UPDATE, updateRequest);
|
||||
|
|
Loading…
Reference in New Issue