Skip to content

Commit

Permalink
Refactoring/1171 naming cleanup rebase (#1263)
Browse files Browse the repository at this point in the history
* squash branch

* regen package-lock

* fix after rebase

* apply formatter

* implement reveiw

* update hostName and subDomain
  • Loading branch information
kcinay055679 authored Dec 24, 2024
1 parent d984f1f commit 5730755
Show file tree
Hide file tree
Showing 324 changed files with 3,839 additions and 3,801 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .run/OkrApplication-E2E.run.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="OkrApplication-E2E" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="integration-test" />
<option name="ALTERNATIVE_JRE_PATH" value="temurin-21" />
<option name="ALTERNATIVE_JRE_PATH" value="$USER_HOME$/.sdkman/candidates/java/current" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<module name="backend" />
<option name="SPRING_BOOT_MAIN_CLASS" value="ch.puzzle.okr.OkrApplication" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/v2/checkIns")
@RequestMapping("api/v2/checkins")
public class CheckInController {

private final CheckInMapper checkInMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
@Controller
public class ClientConfigController {

private final ClientConfigService configService;
private final ClientConfigService clientConfigService;

public ClientConfigController(ClientConfigService configService) {
this.configService = configService;
public ClientConfigController(ClientConfigService clientConfigService) {
this.clientConfigService = clientConfigService;
}

@GetMapping("/config")
public ResponseEntity<ClientConfigDto> getConfig(HttpServletRequest request) {
return ResponseEntity
.status(HttpStatus.OK)
.body(configService.getConfigBasedOnActiveEnv(request.getServerName()));
.body(clientConfigService.getConfigBasedOnActiveEnv(request.getServerName()));
}

@RequestMapping(value = "/**/{[path:[^\\.]*}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ public void deleteObjectiveById(@Parameter(description = "The ID of an Objective
@ApiResponse(responseCode = "401", description = "Not authorized to create an Objective", content = @Content) })
@PostMapping
public ResponseEntity<ObjectiveDto> createObjective(@io.swagger.v3.oas.annotations.parameters.RequestBody(description = "The Objective as json to create a new Objective.", required = true)
@RequestBody ObjectiveDto objectiveDTO) {
Objective objective = objectiveMapper.toObjective(objectiveDTO);
@RequestBody ObjectiveDto objectiveDto) {
Objective objective = objectiveMapper.toObjective(objectiveDto);
ObjectiveDto createdObjective = objectiveMapper.toDto(objectiveAuthorizationService.createEntity(objective));
return ResponseEntity.status(HttpStatus.CREATED).body(createdObjective);
}
Expand Down Expand Up @@ -126,8 +126,8 @@ public ResponseEntity<ObjectiveDto> duplicateObjective(@Parameter(description =
@ApiResponse(responseCode = "422", description = "Can't update Objective since Objective was updated or deleted by another user.", content = @Content) })
@PutMapping("/{id}")
public ResponseEntity<ObjectiveDto> updateObjective(@Parameter(description = "The ID for updating an Objective.", required = true)
@PathVariable Long id, @io.swagger.v3.oas.annotations.parameters.RequestBody(description = "The objective as json to update an existing Objective.", required = true) @RequestBody ObjectiveDto objectiveDTO) {
Objective objective = objectiveMapper.toObjective(objectiveDTO);
@PathVariable Long id, @io.swagger.v3.oas.annotations.parameters.RequestBody(description = "The objective as json to update an existing Objective.", required = true) @RequestBody ObjectiveDto objectiveDto) {
Objective objective = objectiveMapper.toObjective(objectiveDto);
boolean isObjectiveImUsed = objectiveAuthorizationService.isImUsed(objective);
ObjectiveDto updatedObjective = objectiveMapper
.toDto(objectiveAuthorizationService.updateEntity(id, objective));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void deleteTeamById(@Parameter(description = "The ID of an Team to delete
@PutMapping("/{id}/addusers")
public void addUsersToTeam(@Parameter(description = "The ID of an Team to add to users to it.", required = true)
@PathVariable long id, @RequestBody List<UserDto> userDtoList) {
var userIds = userDtoList.stream().map(UserDto::id).toList();
List<Long> userIds = userDtoList.stream().map(UserDto::id).toList();
teamAuthorizationService.addUsersToTeam(id, userIds);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import ch.puzzle.okr.dto.NewUserDto;
import ch.puzzle.okr.dto.UserDto;
import ch.puzzle.okr.dto.userOkrData.UserOkrDataDto;
import ch.puzzle.okr.dto.userokrdata.UserOkrDataDto;
import ch.puzzle.okr.mapper.UserMapper;
import ch.puzzle.okr.models.User;
import ch.puzzle.okr.service.authorization.AuthorizationService;
import ch.puzzle.okr.service.authorization.UserAuthorizationService;
import io.swagger.v3.oas.annotations.Operation;
Expand Down Expand Up @@ -44,7 +45,7 @@ public List<UserDto> getAllUsers() {
@Content(mediaType = "application/json", schema = @Schema(implementation = UserDto.class)) }), })
@GetMapping(path = "/current")
public UserDto getCurrentUser() {
var currentUser = this.authorizationService.updateOrAddAuthorizationUser().user();
User currentUser = this.authorizationService.updateOrAddAuthorizationUser().user();
return userMapper.toDto(currentUser);
}

Expand All @@ -54,7 +55,7 @@ public UserDto getCurrentUser() {
@GetMapping(path = "/{id}")
public UserDto getUserById(@Parameter(description = "The ID for requested user.", required = true)
@PathVariable long id) {
var user = this.userAuthorizationService.getById(id);
User user = this.userAuthorizationService.getById(id);
return userMapper.toDto(user);
}

Expand All @@ -64,7 +65,7 @@ public UserDto getUserById(@Parameter(description = "The ID for requested user."
@PutMapping(path = "/{id}/isokrchampion/{isOkrChampion}")
public UserDto setOkrChampion(@Parameter(description = "The ID for requested user.", required = true)
@PathVariable long id, @Parameter(description = "okrChampion property of user is set to this flag.", required = true) @PathVariable boolean isOkrChampion) {
var user = this.userAuthorizationService.setIsOkrChampion(id, isOkrChampion);
User user = this.userAuthorizationService.setIsOkrChampion(id, isOkrChampion);
return userMapper.toDto(user);
}

Expand All @@ -74,7 +75,7 @@ public UserDto setOkrChampion(@Parameter(description = "The ID for requested use
@PostMapping(path = "/createall")
public List<UserDto> createUsers(@io.swagger.v3.oas.annotations.parameters.RequestBody(description = "The users to create", required = true)
@RequestBody List<NewUserDto> newUserDtoList) {
var createdUsers = this.userAuthorizationService.createUsers(userMapper.toUserList(newUserDtoList));
List<User> createdUsers = this.userAuthorizationService.createUsers(userMapper.toUserList(newUserDtoList));
return userMapper.toDtos(createdUsers);
}

Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/java/ch/puzzle/okr/dto/ActionDto.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package ch.puzzle.okr.dto;

public record ActionDto(Long id, int version, String action, int priority, boolean isChecked, Long keyResultId,
boolean writeable) {
boolean isWriteable) {
}
2 changes: 1 addition & 1 deletion backend/src/main/java/ch/puzzle/okr/dto/NewUserDto.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.puzzle.okr.dto;

public record NewUserDto(String firstname, String lastname, String email) {
public record NewUserDto(String firstName, String lastName, String email) {
}
2 changes: 1 addition & 1 deletion backend/src/main/java/ch/puzzle/okr/dto/ObjectiveDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
import java.time.LocalDateTime;

public record ObjectiveDto(Long id, int version, String title, Long teamId, Long quarterId, String quarterLabel,
String description, State state, LocalDateTime createdOn, LocalDateTime modifiedOn, boolean writeable) {
String description, State state, LocalDateTime createdOn, LocalDateTime modifiedOn, boolean isWriteable) {
}
2 changes: 1 addition & 1 deletion backend/src/main/java/ch/puzzle/okr/dto/TeamDto.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.puzzle.okr.dto;

public record TeamDto(Long id, int version, String name, boolean writeable) {
public record TeamDto(Long id, int version, String name, boolean isWriteable) {
}
2 changes: 1 addition & 1 deletion backend/src/main/java/ch/puzzle/okr/dto/UserDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

import java.util.List;

public record UserDto(Long id, int version, String firstname, String lastname, String email,
public record UserDto(Long id, int version, String firstName, String lastName, String email,
List<UserTeamDto> userTeamList, boolean isOkrChampion) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
@JsonDeserialize(as = CheckInMetricDto.class)
public record CheckInMetricDto(Long id, int version, String changeInfo, String initiatives, Integer confidence,
Long keyResultId, LocalDateTime createdOn, LocalDateTime modifiedOn, Double value,
boolean writeable) implements CheckInDto {
boolean isWriteable) implements CheckInDto {
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
@JsonDeserialize(as = CheckInOrdinalDto.class)
public record CheckInOrdinalDto(Long id, int version, String changeInfo, String initiatives, Integer confidence,
Long keyResultId, LocalDateTime createdOn, LocalDateTime modifiedOn, Zone zone,
boolean writeable) implements CheckInDto {
boolean isWriteable) implements CheckInDto {
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
@JsonDeserialize(as = KeyResultMetricDto.class)
public record KeyResultMetricDto(Long id, int version, String keyResultType, String title, String description,
Double baseline, Double stretchGoal, Unit unit, KeyResultUserDto owner, KeyResultObjectiveDto objective,
KeyResultLastCheckInMetricDto lastCheckIn, LocalDateTime createdOn, LocalDateTime modifiedOn, boolean writeable,
List<ActionDto> actionList) implements KeyResultDto {
KeyResultLastCheckInMetricDto lastCheckIn, LocalDateTime createdOn, LocalDateTime modifiedOn,
boolean isWriteable, List<ActionDto> actionList) implements KeyResultDto {
@Override
public List<ActionDto> getActionList() {
return actionList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public record KeyResultOrdinalDto(Long id, int version, String keyResultType, String title, String description,
String commitZone, String targetZone, String stretchZone, KeyResultUserDto owner,
KeyResultObjectiveDto objective, KeyResultLastCheckInOrdinalDto lastCheckIn, LocalDateTime createdOn,
LocalDateTime modifiedOn, boolean writeable, List<ActionDto> actionList) implements KeyResultDto {
LocalDateTime modifiedOn, boolean isWriteable, List<ActionDto> actionList) implements KeyResultDto {
@Override
public List<ActionDto> getActionList() {
return actionList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.puzzle.okr.dto.keyresult;

public record KeyResultUserDto(Long id, String firstname, String lastname) {
public record KeyResultUserDto(Long id, String firstName, String lastName) {
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

import java.util.List;

public record OverviewDto(OverviewTeamDto team, List<OverviewObjectiveDto> objectives, boolean writeable) {
public record OverviewDto(OverviewTeamDto team, List<OverviewObjectiveDto> objectives, boolean isWriteable) {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.puzzle.okr.dto.userOkrData;
package ch.puzzle.okr.dto.userokrdata;

public record UserKeyResultDataDto(Long keyResultId, String keyResultName, Long objectiveId, String objectiveName) {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.puzzle.okr.dto.userOkrData;
package ch.puzzle.okr.dto.userokrdata;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private Action toAction(ActionDto actionDto, KeyResult keyResult) {
.withVersion(actionDto.version())
.withAction(actionDto.action())
.withPriority(actionDto.priority())
.withIsChecked(actionDto.isChecked())
.isChecked(actionDto.isChecked())
.withKeyResult(keyResult)
.build();
}
Expand Down
12 changes: 6 additions & 6 deletions backend/src/main/java/ch/puzzle/okr/mapper/UserMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public List<UserDto> toDtos(List<User> userList) {
}

public UserDto toDto(User user) {
var userTeams = user
List<UserTeamDto> userTeams = user
.getUserTeamList()
.stream()
.map(ut -> new UserTeamDto(ut.getId(),
Expand All @@ -33,8 +33,8 @@ public UserDto toDto(User user) {

return new UserDto(user.getId(),
user.getVersion(),
user.getFirstname(),
user.getLastname(),
user.getFirstName(),
user.getLastName(),
user.getEmail(),
userTeams,
user.isOkrChampion());
Expand All @@ -45,9 +45,9 @@ public List<User> toUserList(List<NewUserDto> newUserList) {
}

public User toUser(NewUserDto newUserDto) {
var user = new User();
user.setFirstname(newUserDto.firstname());
user.setLastname(newUserDto.lastname());
User user = new User();
user.setFirstName(newUserDto.firstName());
user.setLastName(newUserDto.lastName());
user.setEmail(newUserDto.email());
return user;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ch.puzzle.okr.mapper;

import ch.puzzle.okr.dto.userOkrData.UserKeyResultDataDto;
import ch.puzzle.okr.dto.userOkrData.UserOkrDataDto;
import ch.puzzle.okr.dto.userokrdata.UserKeyResultDataDto;
import ch.puzzle.okr.dto.userokrdata.UserOkrDataDto;
import ch.puzzle.okr.models.keyresult.KeyResult;
import java.util.List;
import org.springframework.stereotype.Component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public KeyResultMetricMapper(UserBusinessService userBusinessService,
public KeyResultDto toDto(KeyResultMetric keyResult, List<Action> actionList) {
KeyResultUserDto ownerDto = new KeyResultUserDto( //
keyResult.getOwner().getId(), //
keyResult.getOwner().getFirstname(), //
keyResult.getOwner().getLastname());
keyResult.getOwner().getFirstName(), //
keyResult.getOwner().getLastName());

KeyResultQuarterDto quarterDto = new KeyResultQuarterDto( //
keyResult.getObjective().getQuarter().getId(), //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public KeyResultOrdinalMapper(UserBusinessService userBusinessService,
public KeyResultDto toDto(KeyResultOrdinal keyResult, List<Action> actionList) {
KeyResultUserDto ownerDto = new KeyResultUserDto( //
keyResult.getOwner().getId(), //
keyResult.getOwner().getFirstname(), //
keyResult.getOwner().getLastname());
keyResult.getOwner().getFirstName(), //
keyResult.getOwner().getLastName());

KeyResultQuarterDto quarterDto = new KeyResultQuarterDto( //
keyResult.getObjective().getQuarter().getId(), //
Expand Down
20 changes: 10 additions & 10 deletions backend/src/main/java/ch/puzzle/okr/models/Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Action implements WriteableInterface {
private int priority;

@NotNull(message = MessageKey.ATTRIBUTE_NOT_NULL)
private boolean isChecked;
private boolean checked;

@NotNull(message = MessageKey.ATTRIBUTE_NOT_NULL)
@ManyToOne
Expand All @@ -40,7 +40,7 @@ private Action(Builder builder) {
version = builder.version;
action = builder.action;
priority = builder.priority;
isChecked = builder.isChecked;
checked = builder.checked;
keyResult = builder.keyResult;
}

Expand Down Expand Up @@ -69,11 +69,11 @@ public void setPriority(int priority) {
}

public boolean isChecked() {
return isChecked;
return checked;
}

public void setChecked(boolean checked) {
isChecked = checked;
this.checked = checked;
}

public KeyResult getKeyResult() {
Expand Down Expand Up @@ -105,7 +105,7 @@ public void setWriteable(boolean writeable) {
@Override
public String toString() {
return "Action{" + "id=" + id + ", version=" + version + ", action='" + action + '\'' + ", priority=" + priority
+ ", isChecked=" + isChecked + ", keyResult=" + keyResult + ", writeable=" + writeable + '}';
+ ", checked=" + checked + ", keyResult=" + keyResult + ", writeable=" + writeable + '}';
}

@Override
Expand All @@ -115,22 +115,22 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass())
return false;
Action action1 = (Action) o;
return version == action1.version && priority == action1.priority && isChecked == action1.isChecked
return version == action1.version && priority == action1.priority && checked == action1.checked
&& writeable == action1.writeable && Objects.equals(id, action1.id)
&& Objects.equals(action, action1.action) && Objects.equals(keyResult, action1.keyResult);
}

@Override
public int hashCode() {
return Objects.hash(id, version, action, priority, isChecked, keyResult, writeable);
return Objects.hash(id, version, action, priority, checked, keyResult, writeable);
}

public static final class Builder {
private Long id;
private int version;
private String action;
private int priority;
private boolean isChecked;
private boolean checked;
private KeyResult keyResult;

private Builder() {
Expand Down Expand Up @@ -160,8 +160,8 @@ public Builder withPriority(int priority) {
return this;
}

public Builder withIsChecked(boolean isChecked) {
this.isChecked = isChecked;
public Builder isChecked(boolean checked) {
this.checked = checked;
return this;
}

Expand Down
Loading

0 comments on commit 5730755

Please sign in to comment.