Profile uzytkownikow#65
Merged
Merged
Conversation
…ips, workload, groups)
There was a problem hiding this comment.
Pull request overview
This PR implements role-aware user profile views in the frontend (own profile + employee/admin user details) and adds the necessary backend/user-management API endpoints (profile, user details, subordinates, managed projects, memberships, groups, qualifications), along with richer DEV seed data to exercise these views.
Changes:
- Frontend: new profile “sections” architecture (cards + shared section header) and updated Profile/Employee/Admin details pages to use it.
- Frontend/Backend: new user-management endpoints + React Query hooks/query-keys to fetch profile-related data.
- Backend: expanded
devdata seeding with users, qualifications, groups, projects, and assignments.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/pages/ProfilePage.tsx | Switches “My profile” to load profile data and render role-based sections. |
| frontend/src/pages/EmployeeDetailsPage.tsx | Implements employee details view with fetch + fallback state user, header, and sections. |
| frontend/src/pages/AdminUserDetailsPage.tsx | Reuses EmployeeDetailsPage for admin user details route. |
| frontend/src/features/user-management/user-management.types.ts | Extends user types (supervisor + project/group-related response types). |
| frontend/src/features/user-management/user-management.service.ts | Adds service calls for new user/profile-related endpoints. |
| frontend/src/features/user-management/user-management.hooks.ts | Adds React Query hooks for profile/user detail sub-resources. |
| frontend/src/features/user-management/query-keys.ts | Adds query keys for new user/profile queries. |
| frontend/src/features/user-management/components/RoleBadge.tsx | Updates role badge to a styled badge with icon + Polish labels. |
| frontend/src/features/qualifications/qualifications.service.ts | Adds API call for fetching another user’s qualifications. |
| frontend/src/features/qualifications/qualifications.hooks.ts | Adds query hook for user qualifications (non-me). |
| frontend/src/features/qualifications/components/QualificationsList.tsx | Adds read-only mode (no “add first skill” hint, no delete). |
| frontend/src/features/qualifications/components/QualificationsCard.tsx | Supports userId + read-only rendering for qualifications section. |
| frontend/src/features/qualifications/components/QualificationItem.tsx | Makes delete action optional for read-only usage. |
| frontend/src/features/profile/profile.config.ts | Introduces role → section flags and hasProfileSections. |
| frontend/src/features/profile/index.ts | Exports new profile section components/config. |
| frontend/src/features/profile/components/WorkloadCard.tsx | New workload section card for profile. |
| frontend/src/features/profile/components/SubordinatesCard.tsx | New subordinates section with filtering + navigation. |
| frontend/src/features/profile/components/SectionHeader.tsx | New shared section header used by multiple collapsible cards. |
| frontend/src/features/profile/components/ProjectMembershipCard.tsx | New memberships/projects participation card. |
| frontend/src/features/profile/components/ProfileSections.tsx | Composes profile sections based on role flags + editable vs read-only. |
| frontend/src/features/profile/components/ProfileHeaderCard.tsx | Redesigns profile header; adds read-only mode + supervisor link. |
| frontend/src/features/profile/components/OwnedGroupsCard.tsx | New card showing groups the user owns/relates to. |
| frontend/src/features/profile/components/ManagedProjectsCard.tsx | New card showing projects managed by the user. |
| frontend/src/api/index.ts | Adds qualifications query key for “by user”. |
| frontend/src/api/endpoints.ts | Adds endpoints for profile and additional /users/{id}/... resources. |
| backend/.../service/user/UserService.java | Adds service methods for user detail and profile-related resources. |
| backend/.../repository/user/UserRepository.java | Adds repository method to find subordinates by supervisor id. |
| backend/.../repository/projectgroup/ProjectGroupRepository.java | Adds repository method to find groups owned by a user. |
| backend/.../controller/user/UserController.java | Adds REST endpoints for user details and profile sub-resources. |
| backend/.../controller/user/ProfileController.java | Adds GET /api/me returning the authenticated user profile. |
| backend/.../controller/dto/user/UserResponse.java | Adds supervisor field to user response DTO. |
| backend/.../controller/dto/project/UserProjectMembershipResponse.java | Adds new DTO for memberships grouped by project. |
| backend/.../controller/dto/project_group/OwnedGroupResponse.java | Adds new DTO including project counts and ownership flag. |
| backend/.../config/DevDataInitializer.java | Expands dev seeding with richer, linked domain data for profiles. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+31
to
+39
| if (isError || !user) { | ||
| return ( | ||
| <div className="mx-auto flex w-full max-w-5xl flex-col gap-6 p-4 sm:p-6"> | ||
| <p className="rounded-lg border border-destructive/20 bg-destructive/10 p-4 text-sm text-destructive"> | ||
| Nie udało się pobrać profilu użytkownika. | ||
| </p> | ||
| </div> | ||
| ); | ||
| } |
Comment on lines
+21
to
+28
| const computeProgress = (startIso: string, endIso: string) => { | ||
| const start = new Date(startIso).getTime(); | ||
| const end = new Date(endIso).getTime(); | ||
| const now = Date.now(); | ||
| if (now <= start) return 0; | ||
| if (now >= end) return 100; | ||
| return Math.round(((now - start) / (end - start)) * 100); | ||
| }; |
Comment on lines
+24
to
+31
| const computeProgress = (startIso: string, endIso: string) => { | ||
| const start = new Date(startIso).getTime(); | ||
| const end = new Date(endIso).getTime(); | ||
| const now = Date.now(); | ||
| if (now <= start) return 0; | ||
| if (now >= end) return 100; | ||
| return Math.round(((now - start) / (end - start)) * 100); | ||
| }; |
Comment on lines
+183
to
+197
| @Transactional(readOnly = true) | ||
| public List<UserProjectMembershipResponse> getProjectMemberships(UUID userId) { | ||
| if (!userRepository.existsById(userId)) { | ||
| throw new ApplicationException(ApiErrorCode.USER_NOT_FOUND, "Cannot find user: " + userId); | ||
| } | ||
| List<ProjectAssignment> assignments = projectAssignmentRepository | ||
| .findAllByUserIdAndStatus(userId, AssignmentStatus.ACCEPTED); | ||
|
|
||
| Map<Project, List<ProjectAssignment>> byProject = assignments.stream() | ||
| .collect(Collectors.groupingBy(ProjectAssignment::getProject, LinkedHashMap::new, Collectors.toList())); | ||
|
|
||
| return byProject.entrySet().stream() | ||
| .map(e -> UserProjectMembershipResponse.from(e.getKey(), e.getValue())) | ||
| .toList(); | ||
| } |
Comment on lines
+17
to
+21
| public static OwnedGroupResponse from(ProjectGroup group, boolean isOwner) { | ||
| int total = group.getProjects() != null ? group.getProjects().size() : 0; | ||
| int active = group.getProjects() != null | ||
| ? (int) group.getProjects().stream().filter(p -> Boolean.TRUE.equals(p.getIsActive())).count() | ||
| : 0; |
mtrznadel24
approved these changes
May 26, 2026
mtrznadel24
left a comment
Collaborator
There was a problem hiding this comment.
dla formalności, bo i tak czasu nie ma
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.