Skip to content

Commit

Permalink
Apply Google Java Style Format
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaiser-Yang authored and github-actions[bot] committed Oct 21, 2024
1 parent 93903a3 commit 4e3fb07
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 25 deletions.
36 changes: 24 additions & 12 deletions src/main/java/edu/cmipt/gcs/controller/RepositoryController.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
Expand Down Expand Up @@ -183,12 +184,11 @@ public ResponseEntity<RepositoryVO> updateRepository(
tags = {"Repository", "Get Method"})
@Parameters({
@Parameter(
name = "userId",
description = "User id",
required = true,
in = ParameterIn.QUERY,
schema = @Schema(implementation = Long.class)
),
name = "userId",
description = "User id",
required = true,
in = ParameterIn.QUERY,
schema = @Schema(implementation = Long.class)),
@Parameter(
name = "repositoryName",
description = "Repository name",
Expand All @@ -201,12 +201,24 @@ public ResponseEntity<RepositoryVO> updateRepository(
@ApiResponse(responseCode = "400", description = "Repository name is invalid")
})
public void checkRepositoryNameValidity(
@RequestParam("repositoryName")
@Size(min = ValidationConstant.MIN_REPOSITORY_NAME_LENGTH, max = ValidationConstant.MAX_REPOSITORY_NAME_LENGTH, message ="REPOSITORYDTO_REPOSITORYNAME_SIZE {RepositoryDTO.repositoryName.Size}")
@NotBlank(message = "REPOSITORYDTO_REPOSITORYNAME_NOTBLANK {RepositoryDTO.repositoryName.NotBlank}")
@Pattern(regexp = ValidationConstant.REPOSITORY_NAME_PATTERN, message = "REPOSITORYNAME_PATTERN_MISMATCH {REPOSITORYNAME_PATTERN_MISMATCH}")
String repositoryName,
@RequestParam("userId") Long userId) {
@RequestParam("repositoryName")
@Size(
min = ValidationConstant.MIN_REPOSITORY_NAME_LENGTH,
max = ValidationConstant.MAX_REPOSITORY_NAME_LENGTH,
message =
"REPOSITORYDTO_REPOSITORYNAME_SIZE"
+ " {RepositoryDTO.repositoryName.Size}")
@NotBlank(
message =
"REPOSITORYDTO_REPOSITORYNAME_NOTBLANK"
+ " {RepositoryDTO.repositoryName.NotBlank}")
@Pattern(
regexp = ValidationConstant.REPOSITORY_NAME_PATTERN,
message =
"REPOSITORYNAME_PATTERN_MISMATCH"
+ " {REPOSITORYNAME_PATTERN_MISMATCH}")
String repositoryName,
@RequestParam("userId") Long userId) {
QueryWrapper<RepositoryPO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", userId);
queryWrapper.eq("repository_name", repositoryName);
Expand Down
21 changes: 10 additions & 11 deletions src/main/java/edu/cmipt/gcs/controller/UserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,14 @@ public void checkUsernameValidity(
content = @Content(schema = @Schema(implementation = ErrorVO.class)))
})
public void checkPasswordValidity(
@RequestParam("userPassword")
@Size(
min = ValidationConstant.MIN_PASSWORD_LENGTH,
max = ValidationConstant.MAX_PASSWORD_LENGTH,
message = "USERDTO_PASSWORD_SIZE {UserDTO.password.Size}")
@NotBlank(message = "USERDTO_PASSWORD_NOTBLANK {UserDTO.password.NotBlank}")
@Pattern(
regexp = ValidationConstant.PASSWORD_PATTERN,
message = "PASSWORD_PATTERN_MISMATCH {PASSWORD_PATTERN_MISMATCH}")
String password) {
}
@RequestParam("userPassword")
@Size(
min = ValidationConstant.MIN_PASSWORD_LENGTH,
max = ValidationConstant.MAX_PASSWORD_LENGTH,
message = "USERDTO_PASSWORD_SIZE {UserDTO.password.Size}")
@NotBlank(message = "USERDTO_PASSWORD_NOTBLANK {UserDTO.password.NotBlank}")
@Pattern(
regexp = ValidationConstant.PASSWORD_PATTERN,
message = "PASSWORD_PATTERN_MISMATCH {PASSWORD_PATTERN_MISMATCH}")
String password) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ public record RepositoryDTO(
"REPOSITORYDTO_REPOSITORYDESCRIPTION_SIZE"
+ " {RepositoryDTO.repositoryDescription.Size}")
String repositoryDescription,
@Schema(description = "Whether or Not Private Repo", example = "false") Boolean isPrivate) {}
@Schema(description = "Whether or Not Private Repo", example = "false")
Boolean isPrivate) {}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public void testCreateRepositoryValid() throws Exception {
"isPrivate": %s
}
"""
.formatted(repositoryName, i % 2 == 0 ? "false" : "true")))
.formatted(
repositoryName,
i % 2 == 0 ? "false" : "true")))
.andExpect(status().isOk());
}
var content =
Expand Down

0 comments on commit 4e3fb07

Please sign in to comment.