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

Probe-IPA Lias #886

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8ed7805
Finish backend implementation
lkleisa Feb 12, 2024
ba99611
Finish frontend implementation
lkleisa Feb 12, 2024
ffa348a
Delete alignment on kr or ob delete
lkleisa Feb 12, 2024
a7079a3
Write objectivecontroller tests
lkleisa Feb 12, 2024
7d51f47
Write ObjectiveAuthorizationService tests
lkleisa Feb 12, 2024
f5802b1
Write AlignmentBusinessService tests
lkleisa Feb 12, 2024
f647d69
Write AlignmentPersistenceService tests
lkleisa Feb 12, 2024
09950c4
Fix AlignmentPersistenceService tests
lkleisa Feb 12, 2024
d0398c1
Fix frontend model error
lkleisa Feb 12, 2024
303175f
Write AlignmentValidationService tests
lkleisa Feb 15, 2024
e45b9af
Write test for objective form component
lkleisa Feb 15, 2024
ede1559
Fix backend test
lkleisa Feb 15, 2024
736c260
Fix backend tests
lkleisa Feb 15, 2024
386ad54
Write e2e tests
lkleisa Feb 15, 2024
f65f91a
Fix e2e tests
lkleisa Feb 15, 2024
cc9a230
Adjust dropdown width
lkleisa Feb 15, 2024
b73b2a8
Add null check for possibility length
lkleisa Feb 28, 2024
bc1a9c8
Fix frontend test
lkleisa Feb 28, 2024
b0bfdbd
Fix e2e test
lkleisa Feb 28, 2024
6a340fb
Remove alignment when objective quarter change
lkleisa Mar 14, 2024
fda90e4
Add missing quarter in testdata and fix bug when editing alignment mu…
lkleisa Apr 25, 2024
1da6bfa
Add Kein Alignment for removing existing alignment
lkleisa Apr 25, 2024
0c195b0
Fix backend tests
lkleisa Apr 25, 2024
66c5e6f
Fix e2e tests because of new quarter
lkleisa Apr 25, 2024
da1d51e
Implement typeahead
lkleisa Apr 29, 2024
de9e864
Sort alignment possibilities alphabetically
lkleisa May 23, 2024
47556f1
Use bold font for optgroup label
lkleisa May 24, 2024
69cadcc
Implement correct filter method for typeahead
lkleisa May 24, 2024
7890c7a
Fix bug with wrong quarter without queryParams
lkleisa May 24, 2024
a7e5193
Add scrollLeft on input leave and adjust padding
lkleisa May 24, 2024
0e799f1
Remove unused files
lkleisa May 24, 2024
3cfe589
Write backend tests
lkleisa May 27, 2024
11458de
Clean up frontend
lkleisa May 27, 2024
7840d20
Adjust frontend tests
lkleisa May 27, 2024
a984129
Adjust e2e tests
lkleisa May 27, 2024
2553996
Fix frontend tests
lkleisa May 29, 2024
f936342
Adjust filter function
lkleisa May 30, 2024
6f5440c
Fix bug with duplicated alignment possibilities
lkleisa Jun 3, 2024
6d0a32e
Simplify backend function
lkleisa Jun 3, 2024
d0b4a48
Add check for alignment in same team
lkleisa Jun 3, 2024
f0c5385
Fix sonar code smells
lkleisa Jun 6, 2024
f4fa8f8
Clean up code
lkleisa Jun 6, 2024
1d2e198
Remove AlignmentSelection
lkleisa Jun 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/src/main/java/ch/puzzle/okr/ErrorKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ public enum ErrorKey {
ATTRIBUTE_NULL, ATTRIBUTE_CHANGED, ATTRIBUTE_SET_FORBIDDEN, ATTRIBUTE_NOT_SET, ATTRIBUTE_CANNOT_CHANGE,
ATTRIBUTE_MUST_BE_DRAFT, KEY_RESULT_CONVERSION, ALREADY_EXISTS_SAME_NAME, CONVERT_TOKEN, DATA_HAS_BEEN_UPDATED,
MODEL_NULL, MODEL_WITH_ID_NOT_FOUND, NOT_AUTHORIZED_TO_READ, NOT_AUTHORIZED_TO_WRITE, NOT_AUTHORIZED_TO_DELETE,
TOKEN_NULL
TOKEN_NULL, NOT_LINK_YOURSELF, NOT_LINK_IN_SAME_TEAM, ALIGNMENT_ALREADY_EXISTS
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ch.puzzle.okr.controller;

import ch.puzzle.okr.dto.AlignmentDto;
import ch.puzzle.okr.dto.ObjectiveDto;
import ch.puzzle.okr.mapper.ObjectiveMapper;
import ch.puzzle.okr.models.Objective;
Expand All @@ -14,6 +15,8 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static org.springframework.http.HttpStatus.IM_USED;
import static org.springframework.http.HttpStatus.OK;

Expand Down Expand Up @@ -42,6 +45,19 @@ public ResponseEntity<ObjectiveDto> getObjective(
.body(objectiveMapper.toDto(objectiveAuthorizationService.getEntityById(id)));
}

@Operation(summary = "Get Alignment possibilities", description = "Get all possibilities to create an Alignment")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Returned all Alignment possibilities for an Objective", content = {
@Content(mediaType = "application/json", schema = @Schema(implementation = AlignmentDto.class)) }),
@ApiResponse(responseCode = "401", description = "Not authorized to get Alignment possibilities", content = @Content),
@ApiResponse(responseCode = "404", description = "Did not find any possibilities to create an Alignment", content = @Content) })
@GetMapping("/alignmentPossibilities/{quarterId}")
public ResponseEntity<List<AlignmentDto>> getAlignmentPossibilities(
@Parameter(description = "The Quarter ID for getting Alignment possibilities.", required = true) @PathVariable Long quarterId) {
return ResponseEntity.status(HttpStatus.OK)
.body(objectiveAuthorizationService.getAlignmentPossibilities(quarterId));
}

@Operation(summary = "Delete Objective by ID", description = "Delete Objective by ID")
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Deleted Objective by ID"),
@ApiResponse(responseCode = "401", description = "Not authorized to delete an Objective", content = @Content),
Expand Down
6 changes: 6 additions & 0 deletions backend/src/main/java/ch/puzzle/okr/dto/AlignmentDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package ch.puzzle.okr.dto;

import java.util.List;

public record AlignmentDto(Long teamId, String teamName, List<AlignmentObjectDto> alignmentObjectDtos) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package ch.puzzle.okr.dto;

public record AlignmentObjectDto(Long objectId, String objectTitle, String objectType) {
}
3 changes: 2 additions & 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,6 @@
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 writeable,
String alignedEntityId) {
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,21 @@ public ObjectiveMapper(TeamBusinessService teamBusinessService, QuarterBusinessS
this.quarterBusinessService = quarterBusinessService;
}

// TODO: Adjust Unit Tests of ObjectiveMapper after merge of multitenancy-main

public ObjectiveDto toDto(Objective objective) {
return new ObjectiveDto(objective.getId(), objective.getVersion(), objective.getTitle(),
objective.getTeam().getId(), objective.getQuarter().getId(), objective.getQuarter().getLabel(),
objective.getDescription(), objective.getState(), objective.getCreatedOn(), objective.getModifiedOn(),
objective.isWriteable());
objective.isWriteable(), objective.getAlignedEntityId());
}

public Objective toObjective(ObjectiveDto objectiveDto) {
return Objective.Builder.builder().withId(objectiveDto.id()).withVersion(objectiveDto.version())
.withTitle(objectiveDto.title()).withTeam(teamBusinessService.getTeamById(objectiveDto.teamId()))
.withDescription(objectiveDto.description()).withModifiedOn(LocalDateTime.now())
.withState(objectiveDto.state()).withCreatedOn(objectiveDto.createdOn())
.withQuarter(quarterBusinessService.getQuarterById(objectiveDto.quarterId())).build();
.withQuarter(quarterBusinessService.getQuarterById(objectiveDto.quarterId()))
.withAlignedEntityId(objectiveDto.alignedEntityId()).build();
}
}
18 changes: 17 additions & 1 deletion backend/src/main/java/ch/puzzle/okr/models/Objective.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class Objective implements WriteableInterface {
private User modifiedBy;

private transient boolean writeable;
private transient String alignedEntityId;

public Objective() {
}
Expand All @@ -68,6 +69,7 @@ private Objective(Builder builder) {
setState(builder.state);
setCreatedOn(builder.createdOn);
setModifiedBy(builder.modifiedBy);
setAlignedEntityId(builder.alignedEntityId);
}

public Long getId() {
Expand Down Expand Up @@ -160,12 +162,20 @@ public void setWriteable(boolean writeable) {
this.writeable = writeable;
}

public String getAlignedEntityId() {
return alignedEntityId;
}

public void setAlignedEntityId(String alignedEntityId) {
this.alignedEntityId = alignedEntityId;
}

@Override
public String toString() {
return "Objective{" + "id=" + id + ", version=" + version + ", title='" + title + '\'' + ", createdBy="
+ createdBy + ", team=" + team + ", quarter=" + quarter + ", description='" + description + '\''
+ ", modifiedOn=" + modifiedOn + ", state=" + state + ", createdOn=" + createdOn + ", modifiedBy="
+ modifiedBy + ", writeable=" + writeable + '\'' + '}';
+ modifiedBy + ", writeable=" + writeable + ", alignedEntityId=" + alignedEntityId + '\'' + '}';
}

@Override
Expand Down Expand Up @@ -201,6 +211,7 @@ public static final class Builder {
private State state;
private LocalDateTime createdOn;
private User modifiedBy;
private String alignedEntityId;

private Builder() {
}
Expand Down Expand Up @@ -264,6 +275,11 @@ public Builder withModifiedBy(User modifiedBy) {
return this;
}

public Builder withAlignedEntityId(String alignedEntityId) {
this.alignedEntityId = alignedEntityId;
return this;
}

public Objective build() {
return new Objective(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public int getVersion() {
return version;
}
Expand Down