Skip to content

[#170] Add user availability - #184

Merged
sksingh2005 merged 1 commit into
mnemosyne-systems:mainfrom
Huda-Amr:feature/user-availability
Oct 29, 2026
Merged

sksingh2005 merged 1 commit into
mnemosyne-systems:mainfrom
Huda-Amr:feature/user-availability

Conversation

@Huda-Amr

Copy link
Copy Markdown
Contributor

Summary

Adds a user availability system that allows users to define periods when they are unavailable, so other users can see when a response should not be expected.

Behavior

Users can manage their availability periods through the Availability page.

  • Users can create availability entries with a start and end date.
  • Availability information is shown through an availability badge.
  • Existing availability entries can be viewed and managed from the Availability interface.
  • Availability data is preserved and exposed through the backend API.

Backend

  • Added UserAvailability model for storing user availability periods.
  • Added UserAvailabilityApiResource with the availability API endpoints.
  • Added UserAvailabilityService for availability business logic and validation.
  • Added comprehensive API tests covering the availability functionality.
  • Updated AppSessionResource to support the availability functionality.

Frontend

  • Added AvailabilityPage.
  • Added AvailabilityCalendar for displaying availability periods.
  • Added AvailabilityDialog for creating and managing availability entries.
  • Added AvailabilityBadge for displaying availability information.
  • Integrated the availability UI with the existing application.

Testing

  • Added UserAvailabilityApireSourceTest covering the availability API and its validation/behavior.
  • Verified the backend availability flow through the API test suite.

@Huda-Amr Huda-Amr changed the title ## [#170] Add user availability [#170] Add user availability Sep 10, 2026
@sksingh2005

Copy link
Copy Markdown
Collaborator

@Huda-Amr please check Developers.md once . You need authors

@sksingh2005 sksingh2005 added the feature A new feature label Sep 11, 2026
@sksingh2005

Copy link
Copy Markdown
Collaborator

@Huda-Amr CI

@Huda-Amr
Huda-Amr force-pushed the feature/user-availability branch 3 times, most recently from 3ea9f33 to 9a38934 Compare September 11, 2026 05:56
@Huda-Amr

Copy link
Copy Markdown
Contributor Author

@sksingh2005 done

@sksingh2005

Copy link
Copy Markdown
Collaborator

@Huda-Amr Thanks for working on this one.

Issue #170 asks to "flag when they are not in the office so we can't expect a reply" but there is no way for anyone to see another user's availability:

  • Only GET /api/availability/me exists (own entries only). No endpoint returns another user's OOO status.
  • Support/superusers can't see users'/TAMs' out-of-office periods anywhere.
  • Regular users and TAMs can't see their own company's blackout periods — GET /company is support/superuser only.

The management half is there; the visibility half (the actual point of the issue) isn't.

Related: UserAvailabilityService contains ~150 lines of dead code with zero callers isUnavailable, getWarningsForTicket, addUserWarning, buildUserWarning, buildCompanyWarning, displayUser. This looks like the visibility/ticket-warning feature that was never wired in. Either integrate it or remove it; shipping unreachable code is misleading.

@sksingh2005

Copy link
Copy Markdown
Collaborator

Bugs

  • Validation errors return 500 + HTML, not 400/404 + JSON. The service throws IllegalArgumentException for missing dates, end-before-start, overlapping periods, and not-found on update/delete. There's no mapper for it, so GlobalExceptionMapper returns the HTML error page with status 500. The tests mask this assertRejected uses greaterThanOrEqualTo(400), so 500 passes. The frontend also can't show the real message (body is HTML -> generic "Unable to save availability."). Should map to BadRequestException/NotFoundException (or an IllegalArgumentException → 400 mapper) and assert exact status codes in tests.

  • reason is unbounded. It maps to varchar(255); anything longer fails at flush time → another 500. Needs a length validation backend-side and maxLength on the frontend input.

  • Admin role is inconsistent. Service allows TYPE_ADMIN for company-scope operations, but requireSupportOrSuperuser in the resource excludes admin, the frontend's canManageCompany excludes admin, and admin gets no Availability nav link. These need to agree.

Minor

  • Test file is UserAvailabilityApireSourceTest.java but the class is UserAvailabilityApiResourceTest — typo in the filename.
  • No user manual chapter every other feature area has one under doc/manual/en/ so try to add that in manual.

@jesperpedersen

Copy link
Copy Markdown
Contributor

We can expand data types if necessary

@Huda-Amr
Huda-Amr force-pushed the feature/user-availability branch 3 times, most recently from 8c0d34d to 92ec414 Compare September 16, 2026 00:33
@jesperpedersen

Copy link
Copy Markdown
Contributor

@Huda-Amr Rebase

@Huda-Amr

Copy link
Copy Markdown
Contributor Author

@jesperpedersen Thanks for checking in
I’m still working on the remaining changes and will update you once everything is ready.

@sksingh2005

Copy link
Copy Markdown
Collaborator

@Huda-Amr how are you doing on this one ? Any help needed ?

@sksingh2005
sksingh2005 force-pushed the feature/user-availability branch 2 times, most recently from 9b3a57d to 7748b5f Compare October 28, 2026 22:39
@jesperpedersen

Copy link
Copy Markdown
Contributor

@sksingh2005 Check CI, and lets merge

@sksingh2005
sksingh2005 force-pushed the feature/user-availability branch from 7748b5f to ab128d8 Compare October 29, 2026 22:28
@sksingh2005
sksingh2005 merged commit 213c04c into mnemosyne-systems:main Oct 29, 2026
2 checks passed
@sksingh2005 sksingh2005 mentioned this pull request Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants