Skip to content

Wnioski o kwalifikacje pracownikow#52

Merged
rrogalski merged 8 commits into
developfrom
kwalifikacje-pracownikow
May 11, 2026
Merged

Wnioski o kwalifikacje pracownikow#52
rrogalski merged 8 commits into
developfrom
kwalifikacje-pracownikow

Conversation

@rrogalski

Copy link
Copy Markdown
Collaborator

dodałem obsługę wniosków o kwalifikacje pracownika

image image

@mistermotopl mistermotopl 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.

Ogólnie wygląda git


List<Qualification> allowedQualifications = qualificationRepository.findAllByIdInAndUserSupervisorId(ids, managerId);

if (allowedQualifications.size() != ids.size()) {

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.

Nie powinniśmy rzucać ACCESS_DENIED w sekcji z logiką biznesową, a raczej taki rodzaj błędu tutaj niezbyt pasuje.

for (Qualification qualification : allowedQualifications) {
var action = activeRequestsMap.get(qualification.getId()).action();

validateWaitingStatus(qualification);

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.

Jeżeli chcemy tytlko WAITING to można też odrazu z bazy pobrać tylko kwalifikacje z WAITING.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

z uwagi na to, że wyżej ma miejsce taka walidacja:

        if (allowedQualifications.size() != ids.size()) {
            throw new ApplicationException(ApiErrorCode.QUALIFICATION_OWNER_NOT_SUBORDINATE);
        }

to rozmiary mogłyby się nie zgadzać m.in. przez wyciągnięcie samych rekordów ze statusem WAITING, chyba najprościej jest to rozwiązać wyciągając wszystkie i sprawdzać na dalszym etapie czy coś ma inny status niż waiting

validateWaitingStatus(qualification);

if (action == QualificationUpdateAction.ACCEPT) {
qualification.setStatus(QualificationStatus.ACCEPTED);

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.

Tą logike też można przenieść do encji Qualification.

variant="outline"
className="border-amber-500 text-amber-700 bg-amber-50 font-medium"
>
{count} {count === 1 ? 'WNIOSEK' : 'WNIOSKI'} OCZEKUJĄCE

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.

Jak chcemy być dokładni to:

  1. dla 1 WNIOSEK
  2. dla 2 do 4 WNIOSKI
  3. reszta to WNIOSKÓW

Comment on lines +76 to +82
@GetMapping("/qualifications/details")
@PreAuthorize("hasRole('LINEAR_MANAGER')")
public ResponseEntity<List<QualificationDetailsResponse>> getQualificationRequestDetails(
@AuthenticationPrincipal UserPrincipal principal,
@RequestParam UUID userId
) {
return ResponseEntity.ok(qualificationService.getPendingForUser(principal.userId(), userId));

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.

Myślę, że warto sprawdzić czy manager liniowy jest managerem użytkownika, którego kwalifikacje chce zobaczyć, można wykorzystać preauthorize

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok, dodałem to

@rrogalski rrogalski merged commit dc0b478 into develop May 11, 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