Skip to content

Commit

Permalink
Merge pull request #86 from focus-shift/align-with-uv-5.9
Browse files Browse the repository at this point in the history
Align with uv 5.9
  • Loading branch information
grafjo authored Dec 7, 2024
2 parents 754690e + 925089f commit aa88434
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package de.focus_shift.urlaubsverwaltung.extension.api.person;

/** Describes which kind of mail notifications a person can have. */
public enum MailNotificationDTO {
NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_APPLIED,
NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_ALLOWED,
NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_REVOKED,
NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_REJECTED,
NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_TEMPORARY_ALLOWED,
NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_CANCELLATION,
NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_EDITED,
NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_CONVERTED,
NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_WAITING_REMINDER,

NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_CANCELLATION_REQUESTED,

NOTIFICATION_EMAIL_APPLICATION_APPLIED,
NOTIFICATION_EMAIL_APPLICATION_ALLOWED,
NOTIFICATION_EMAIL_APPLICATION_REVOKED,
NOTIFICATION_EMAIL_APPLICATION_REJECTED,
NOTIFICATION_EMAIL_APPLICATION_TEMPORARY_ALLOWED,
NOTIFICATION_EMAIL_APPLICATION_CANCELLATION,
NOTIFICATION_EMAIL_APPLICATION_EDITED,
NOTIFICATION_EMAIL_APPLICATION_CONVERTED,
NOTIFICATION_EMAIL_APPLICATION_UPCOMING,

NOTIFICATION_EMAIL_APPLICATION_HOLIDAY_REPLACEMENT,
NOTIFICATION_EMAIL_APPLICATION_HOLIDAY_REPLACEMENT_UPCOMING,

NOTIFICATION_EMAIL_APPLICATION_COLLEAGUES_ALLOWED,
NOTIFICATION_EMAIL_APPLICATION_COLLEAGUES_CANCELLATION,

NOTIFICATION_EMAIL_PERSON_NEW_MANAGEMENT_ALL,

NOTIFICATION_EMAIL_OVERTIME_MANAGEMENT_APPLIED,
NOTIFICATION_EMAIL_OVERTIME_APPLIED_BY_MANAGEMENT,
NOTIFICATION_EMAIL_OVERTIME_APPLIED,

NOTIFICATION_EMAIL_SICK_NOTE_SUBMITTED_BY_USER_TO_USER,
NOTIFICATION_EMAIL_SICK_NOTE_SUBMITTED_BY_USER_TO_MANAGEMENT,
NOTIFICATION_EMAIL_SICK_NOTE_CREATED_BY_MANAGEMENT,
NOTIFICATION_EMAIL_SICK_NOTE_CREATED_BY_MANAGEMENT_TO_MANAGEMENT,
NOTIFICATION_EMAIL_SICK_NOTE_ACCEPTED_BY_MANAGEMENT_TO_USER,
NOTIFICATION_EMAIL_SICK_NOTE_ACCEPTED_BY_MANAGEMENT_TO_MANAGEMENT,
NOTIFICATION_EMAIL_SICK_NOTE_EDITED_BY_MANAGEMENT,
NOTIFICATION_EMAIL_SICK_NOTE_CANCELLED_BY_MANAGEMENT,
NOTIFICATION_EMAIL_SICK_NOTE_COLLEAGUES_CREATED,
NOTIFICATION_EMAIL_SICK_NOTE_COLLEAGUES_CANCELLED;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@ public class PersonDTO {
@NonNull private String email;
@Builder.Default private boolean enabled = true;
@NonNull private Set<RoleDTO> permissions;
@NonNull private Set<MailNotificationDTO> notifications;

public PersonDTO disable() {
return new PersonDTO(
getId(), getUsername(), getLastName(), getFirstName(), getEmail(), false, Set.of());
getId(),
getUsername(),
getLastName(),
getFirstName(),
getEmail(),
false,
Set.of(),
getNotifications());
}

public PersonDTO enable() {
Expand All @@ -30,6 +38,7 @@ public PersonDTO enable() {
getFirstName(),
getEmail(),
true,
Set.of(RoleDTO.USER));
Set.of(RoleDTO.USER),
getNotifications());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ public enum RoleDTO {
SECOND_STAGE_AUTHORITY,
BOSS,
OFFICE,
ADMIN,
APPLICATION_ADD,
APPLICATION_CANCEL,
APPLICATION_CANCELLATION_REQUESTED,
PERSON_ADD,
SICK_NOTE_VIEW,
SICK_NOTE_ADD,
SICK_NOTE_EDIT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ void happyPath() {
.firstName("Marlene")
.email("[email protected]")
.permissions(Set.of(RoleDTO.USER))
.notifications(Set.of(MailNotificationDTO.NOTIFICATION_EMAIL_APPLICATION_APPLIED))
.build();

assertThat(person).isNotNull();
Expand All @@ -28,6 +29,8 @@ void happyPath() {
assertThat(person.getEmail()).isEqualTo("[email protected]");
assertThat(person.isEnabled()).isTrue();
assertThat(person.getPermissions()).containsOnly(RoleDTO.USER);
assertThat(person.getNotifications())
.containsOnly(MailNotificationDTO.NOTIFICATION_EMAIL_APPLICATION_APPLIED);
}

@Test
Expand Down Expand Up @@ -55,6 +58,7 @@ private static PersonDTO anyPerson() {
.firstName("Marlene")
.email("[email protected]")
.permissions(Set.of(RoleDTO.USER))
.notifications(Set.of(MailNotificationDTO.NOTIFICATION_EMAIL_APPLICATION_APPLIED))
.build();
}
}

0 comments on commit aa88434

Please sign in to comment.