Skip to content

Commit

Permalink
#144: add reviews state dto
Browse files Browse the repository at this point in the history
  • Loading branch information
iam-flo committed Nov 25, 2024
1 parent faf38bc commit 3e6a6c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public record ReviewActivityDto(
@NonNull Long id,
@NonNull Boolean isDismissed,
@NonNull ReviewActivityState state,
@NonNull ReviewActivityStateDto state,
@NonNull Integer codeComments,
UserInfoDTO author,
PullRequestInfoDTO pullRequest) {
Expand All @@ -32,27 +32,27 @@ public static ReviewActivityDto fromPullRequest(PullRequest pullRequest) {
return new ReviewActivityDto(
pullRequest.getId(),
false,
ReviewActivityState.REVIEW_REQUESTED,
ReviewActivityStateDto.REVIEW_REQUESTED,
0,
UserInfoDTO.fromUser(pullRequest.getAuthor()),
PullRequestInfoDTO.fromPullRequest(pullRequest)
);
}

public enum ReviewActivityState {
public enum ReviewActivityStateDto {
COMMENTED,
APPROVED,
CHANGES_REQUESTED,
REVIEW_REQUESTED,
UNKNOWN;
}

public static ReviewActivityState fromPullRequestReviewState(PullRequestReview.State state) {
public static ReviewActivityStateDto fromPullRequestReviewState(PullRequestReview.State state) {
return switch (state) {
case COMMENTED -> ReviewActivityState.COMMENTED;
case APPROVED -> ReviewActivityState.APPROVED;
case CHANGES_REQUESTED -> ReviewActivityState.CHANGES_REQUESTED;
default -> ReviewActivityState.UNKNOWN;
case COMMENTED -> ReviewActivityStateDto.COMMENTED;
case APPROVED -> ReviewActivityStateDto.APPROVED;
case CHANGES_REQUESTED -> ReviewActivityStateDto.CHANGES_REQUESTED;
default -> ReviewActivityStateDto.UNKNOWN;
};
}
}
6 changes: 2 additions & 4 deletions webapp/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import { ImprintComponent } from '@app/legal/imprint.component';
import { PrivacyComponent } from '@app/legal/privacy.component';
import { AdminGuard } from '@app/core/security/admin.guard';
import { AuthGuard } from '@app/core/security/auth.guard';
import {
ActivityDashboardComponent
} from '@app/home/activity-dashboard/activity-dashboard/activity-dashboard.component';
import { ActivityDashboardComponent } from '@app/home/activity-dashboard/activity-dashboard/activity-dashboard.component';

export const routes: Routes = [
// Public routes
Expand Down Expand Up @@ -52,7 +50,7 @@ export const routes: Routes = [
{ path: 'settings', component: SettingsComponent },
{ path: 'workspace', component: WorkspaceComponent, canActivate: [AdminGuard] }
]
}
},
{ path: 'user/:id', component: UserProfileComponent },
{ path: 'activity/:id', component: ActivityDashboardComponent }
];

0 comments on commit 3e6a6c0

Please sign in to comment.