Skip to content

Commit

Permalink
Refactor naming in backend and in cypress dir in frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomTannenbaum committed Dec 17, 2024
1 parent 0ddb845 commit 8c3fc2b
Show file tree
Hide file tree
Showing 215 changed files with 1,508 additions and 1,573 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,16 +12,16 @@
@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 @@ -60,8 +60,8 @@ public void deleteObjectiveById(
@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);
@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);
ObjectiveDto createdObjective = objectiveMapper.toDto(objectiveAuthorizationService.createEntity(objective));
return ResponseEntity.status(HttpStatus.CREATED).body(createdObjective);
}
Expand All @@ -72,8 +72,8 @@ public ResponseEntity<ObjectiveDto> createObjective(
@PostMapping("/{id}")
public ResponseEntity<ObjectiveDto> duplicateObjective(
@Parameter(description = "The ID for duplicating an Objective.", required = true) @PathVariable Long id,
@io.swagger.v3.oas.annotations.parameters.RequestBody(description = "The Objective which should be duplicated as json", required = true) @RequestBody ObjectiveDto objectiveDTO) {
Objective objective = objectiveMapper.toObjective(objectiveDTO);
@io.swagger.v3.oas.annotations.parameters.RequestBody(description = "The Objective which should be duplicated as json", required = true) @RequestBody ObjectiveDto objectiveDto) {
Objective objective = objectiveMapper.toObjective(objectiveDto);
ObjectiveDto duplicatedObjectiveDto = objectiveMapper
.toDto(objectiveAuthorizationService.duplicateEntity(id, objective));
return ResponseEntity.status(HttpStatus.CREATED).body(duplicatedObjectiveDto);
Expand All @@ -92,8 +92,8 @@ public ResponseEntity<ObjectiveDto> duplicateObjective(
@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);
@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 @@ -84,7 +84,7 @@ public void deleteTeamById(
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 @@ -45,7 +46,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 @@ -55,7 +56,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 @@ -66,7 +67,7 @@ public UserDto getUserById(
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 @@ -76,7 +77,7 @@ public UserDto setOkrChampion(
@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 @@ -5,5 +5,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,6 +6,6 @@

@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)
Long keyResultId, LocalDateTime createdOn, LocalDateTime modifiedOn, Double value, boolean isWriteable)
implements CheckInDto {
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

@JsonDeserialize(as = CheckInOrdinalDto.class)
public record CheckInOrdinalDto(Long id, int version, String changeInfo, String initiatives, Integer confidence,
Long keyResultId, LocalDateTime createdOn, LocalDateTime modifiedOn, Zone value, boolean writeable)
Long keyResultId, LocalDateTime createdOn, LocalDateTime modifiedOn, Zone value, boolean isWriteable)
implements CheckInDto {
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,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 @@ -10,7 +10,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 @@ -34,7 +34,7 @@ public List<Action> toActions(List<ActionDto> actionDtos) {

private Action toAction(ActionDto actionDto, KeyResult keyResult) {
return Action.Builder.builder().withId(actionDto.id()).withVersion(actionDto.version())
.withAction(actionDto.action()).withPriority(actionDto.priority()).withIsChecked(actionDto.isChecked())
.withAction(actionDto.action()).withPriority(actionDto.priority()).isChecked(actionDto.isChecked())
.withKeyResult(keyResult).build();
}
}
10 changes: 5 additions & 5 deletions backend/src/main/java/ch/puzzle/okr/mapper/UserMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public List<UserDto> toDtos(List<User> userList) {
}

public UserDto toDto(User user) {
var userTeams = user.getUserTeamList().stream().map(
List<UserTeamDto> userTeams = user.getUserTeamList().stream().map(
ut -> new UserTeamDto(ut.getId(), user.getVersion(), teamMapper.toDto(ut.getTeam()), ut.isTeamAdmin()))
.collect(Collectors.toList());

return new UserDto(user.getId(), user.getVersion(), user.getFirstname(), user.getLastname(), user.getEmail(),
return new UserDto(user.getId(), user.getVersion(), user.getFirstName(), user.getLastName(), user.getEmail(),
userTeams, user.isOkrChampion());
}

Expand All @@ -36,9 +36,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 org.springframework.stereotype.Component;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,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 @@ -34,8 +34,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 @@ -25,7 +25,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 @@ -41,7 +41,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 @@ -70,11 +70,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 @@ -106,7 +106,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 @@ -116,22 +116,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 @@ -161,8 +161,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 8c3fc2b

Please sign in to comment.