Skip to content

Profile uzytkownikow#65

Merged
sbarczyk merged 12 commits into
developfrom
profile-uzytkownikow
May 26, 2026
Merged

Profile uzytkownikow#65
sbarczyk merged 12 commits into
developfrom
profile-uzytkownikow

Conversation

@sbarczyk

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 dev data 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;
Comment thread frontend/src/features/profile/components/SectionHeader.tsx
Comment thread frontend/src/features/profile/components/ProfileHeaderCard.tsx

@mtrznadel24 mtrznadel24 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dla formalności, bo i tak czasu nie ma

@sbarczyk sbarczyk merged commit 76a803c into develop May 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants