Skip to content

Commit

Permalink
add isBacklogQuarter to objective mapper to check for it in the error…
Browse files Browse the repository at this point in the history
… interceptor
  • Loading branch information
Miguel7373 committed Jan 23, 2025
1 parent ec9970b commit 38800ad
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
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 @@ -3,6 +3,6 @@
import ch.puzzle.okr.models.State;
import java.time.LocalDateTime;

public record ObjectiveDto(Long id, int version, String title, Long teamId, Long quarterId, String quarterLabel,
public record ObjectiveDto(Long id, int version, String title, Long teamId, Long quarterId, String quarterLabel, boolean isBacklogQuarter,
String description, State state, LocalDateTime createdOn, LocalDateTime modifiedOn, boolean isWriteable) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public ObjectiveDto toDto(Objective objective) {
objective.getTeam().getId(),
objective.getQuarter().getId(),
objective.getQuarter().getLabel(),
objective.getQuarter().isBacklogQuarter(),
objective.getDescription(),
objective.getState(),
objective.getCreatedOn(),
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/app/interceptors/error.interceptor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ describe('ErrorInterceptor', () => {
ok: true,
body: {
objectiveTitle: 'Das ist der Titel',
quarterId: 999
quarterId: 999,
isBacklogQuarter: true
}
};

Expand Down
7 changes: 3 additions & 4 deletions frontend/src/app/interceptors/error.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { catchError, filter, Observable, tap, throwError } from 'rxjs';
import { Router } from '@angular/router';
import {
DRAWER_ROUTES,
ERROR_MESSAGE_KEY_PREFIX,
MessageEntry, MessageStatusCode,
ERROR_MESSAGE_KEY_PREFIX, MessageEntry, MessageStatusCode,
SUCCESS_MESSAGE_KEY_PREFIX,
SUCCESS_MESSAGE_MAP
} from '../shared/constant-library';
Expand Down Expand Up @@ -56,8 +55,8 @@ export class ErrorInterceptor implements HttpInterceptor {
}

let messageKey = successMessageObj.key;
const isBacklogQuarter = response.body?.quarter?.isBacklogQuarter;
console.log('hallo' + isBacklogQuarter);
console.log(response.body);
const isBacklogQuarter = response.body?.isBacklogQuarter;
if (messageKey == 'OBJECTIVE.POST' && isBacklogQuarter) {
messageKey += '_BACKLOG';
}
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/shared/constant-library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export const DATE_FORMAT = 'dd.MM.yyyy';
export const DRAWER_ROUTES = ['objective',
'keyresult'];

export const GJ_REGEX_PATTERN = /^GJ \d{2}\/\d{2}-Q\d$/;

export const SUCCESS_MESSAGE_MAP: MessageKeyMap = {
teams: {
KEY: 'TEAM',
Expand Down

0 comments on commit 38800ad

Please sign in to comment.