Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactoring/1171 naming cleanup #1210

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4ebacfa
Refactor naming in backend and in cypress dir in frontend
RandomTannenbaum Dec 17, 2024
98ad480
Fix casing after rebase
RandomTannenbaum Dec 17, 2024
056ff90
Rename variable and test
RandomTannenbaum Dec 18, 2024
0ec929d
Add displayname annotation to each test in architectureTests
ManuelMoeri Dec 18, 2024
e79fb2e
Add displayname annotation to each test in the controller folder
ManuelMoeri Dec 18, 2024
af1d90e
Add displayname annotation to each test in the deserializer folder
ManuelMoeri Dec 18, 2024
fa97f4d
Add displayname annotation to each test in the mapper folder
ManuelMoeri Dec 18, 2024
05b6d67
Add displayname annotation to each test in the models folder
ManuelMoeri Dec 18, 2024
04011c5
Add displayname annotation to each test in the service.validation pac…
MasterEvarior Dec 18, 2024
559bfb8
Refactor naming in components up to overview component
RandomTannenbaum Dec 18, 2024
09f44a2
Add isplayname annotation to each test in the mulitenancy folder
ManuelMoeri Dec 19, 2024
85014a5
Add isplayname annotation to each test in the security folder
ManuelMoeri Dec 19, 2024
eeed326
Add isplayname annotation to each test in the util.quarter folder and…
ManuelMoeri Dec 19, 2024
4a8d07f
Add displayname annotation to each test in the service.persistence pa…
MasterEvarior Dec 19, 2024
8824931
Add displayname annotation to each test in the service.clientconfig p…
MasterEvarior Dec 19, 2024
5318404
Make 'Should' uppercase in display names
MasterEvarior Dec 19, 2024
c3ddc70
Fix displayname annotation for parameterized test in the service.clie…
MasterEvarior Dec 19, 2024
7c21118
Add display names for some business service test classes
MasterEvarior Dec 19, 2024
f463d30
Add display names for some business service test classes
MasterEvarior Dec 19, 2024
fe41dee
Add display names and rename tests in authorization folder
ManuelMoeri Dec 19, 2024
56f83aa
change all businessservices to use displayname annotation to properly…
nevio18324 Dec 19, 2024
4d4d51c
Merge remote-tracking branch 'refs/remotes/origin/refactoring/1171-na…
nevio18324 Dec 19, 2024
5e9a33f
[FM] Automated formating backend
actions-user Dec 19, 2024
3579107
make all businessservice tests start with should
nevio18324 Dec 19, 2024
150d7ca
Merge remote-tracking branch 'refs/remotes/origin/refactoring/1171-na…
nevio18324 Dec 19, 2024
cf9d857
[FM] Automated formating backend
actions-user Dec 19, 2024
a550d5c
change naming of ValidationServiceTests so that all test names start …
nevio18324 Dec 19, 2024
2e167c8
make the first letter of all should's inside @Displayname Uppercase
nevio18324 Dec 19, 2024
e92e6a8
make every test inside ObjectiveValidationServiceTest start with shou…
nevio18324 Dec 19, 2024
38db5fa
make every tests name inside OverviewValidation start with should
nevio18324 Dec 19, 2024
968dfc6
Fix a couple of mistakes in the test naming folders
ManuelMoeri Dec 19, 2024
d7addcc
make every tests name inside QuarterValidationServiceTest start with…
nevio18324 Dec 19, 2024
ed89a4f
Merge remote-tracking branch 'refs/remotes/origin/refactoring/1171-na…
nevio18324 Dec 19, 2024
cd4ab66
Refactor naming in last three components
RandomTannenbaum Dec 20, 2024
ed72e4b
Refactor app/guards
RandomTannenbaum Dec 20, 2024
3309fec
Refactor interceptors and duplicate objective cypress tests
RandomTannenbaum Dec 20, 2024
613f522
Finish renaming of the @DisplayName annotations
ManuelMoeri Dec 20, 2024
7f65fe9
Refactor app/shared/custom
RandomTannenbaum Dec 20, 2024
710fbc5
fix testfiles of services and shared
kcinay055679 Dec 23, 2024
67cc87a
check naming in team-management of everything below new-user
nevio18324 Dec 23, 2024
434d93f
fix naming of team management
kcinay055679 Dec 23, 2024
867ee49
[FM] Automated formating frontend
actions-user Dec 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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")
RandomTannenbaum marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -90,8 +90,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 Down Expand Up @@ -124,8 +124,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 zone, boolean writeable)
Long keyResultId, LocalDateTime createdOn, LocalDateTime modifiedOn, Zone zone, 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