Add optional imported events to calendar API - #659
Merged
thomasluizon merged 2 commits intoSep 29, 2026
Merged
Conversation
There was a problem hiding this comment.
Important
The opt-in response can still hide previously imported recurring events when their schedule cannot be projected into the account timezone.
Reviewed changes Adds an opt-in import status view to the existing calendar events response while leaving the default JSON unchanged.
- HTTP and contract: The controller forwards
includeImported; OpenAPI describes the query parameter and response fields. - Event query: The opt-in path maps active, user-owned habits by Google event ID and annotates fetched events with import status and linked habit ID.
- Coverage: Handler, controller, and serialization tests cover the default and opt-in paths.
GPT Sol | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes Re-reviewed the linked recurring-event fix in 1b105175 against the full calendar API diff.
- Linked event visibility: Preserved opt-in events linked to active habits even when their recurrence cannot be projected for a new import.
- Regression coverage: Extended the recurring-event handler test to verify linked events appear in the opt-in response while unlinked events and the default response remain filtered.
GPT Sol | 𝕏
thomasluizon
deleted the
feature/ticket-937-imported-calendar-events
branch
September 29, 2026 10:36
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.

Change
Adds an optional
includeImportedquery parameter toGET /api/Calendar/events. The default path keeps filtering imported events and keeps the existing response JSON. With the parameter set to true, the response includes fetched events from the caller's selected calendars, setsisImportedfor each event, and suppliesimportedHabitIdwhen an active habit is linked. Deleted habits and habits owned by other users do not mark an event imported.The controller forwards the option in
src/Orbit.Api/Controllers/CalendarController.cs. The query and optional response fields live insrc/Orbit.Application/Calendar/Queries/GetCalendarEventsQuery.cs. The generated contract insrc/Orbit.Api/openapi.jsondescribes the parameter and fields. Focused handler, serialization, and controller tests cover the opt-in and default paths. The optional fields are omitted from default JSON so installed clients receive the same response.Refs thomasluizon/orbit-tickets#937.
Assumptions
includeImportedcontract as complete and changed the handler rather than the DTO or OpenAPI snapshot. The alternative was to revise the contract, which this finding did not require.Test evidence
dotnet test tests/Orbit.Application.Tests/Orbit.Application.Tests.csproj --filter 'FullyQualifiedName~GetCalendarEventsQueryHandlerTests.Handle_FiltersOutAlreadyImportedHabitsByGoogleEventId' -v normalpassed one test with the opt-in defect present.dotnet test tests/Orbit.Application.Tests/Orbit.Application.Tests.csproj --no-restore --filter 'FullyQualifiedName~Handle_IncludeImported_ReturnsImportedAndAvailableEvents' -v quietfailed with CS1739 becauseGetCalendarEventsQueryhad noIncludeImportedparameter. The new behavior could not execute until its contract existed.dotnet test tests/Orbit.Application.Tests/Orbit.Application.Tests.csproj --no-restore --filter 'FullyQualifiedName~GetCalendarEventsQueryHandlerTests|FullyQualifiedName~CalendarEventItemSerializationTests' -v minimalpassed 80 tests.dotnet test tests/Orbit.Infrastructure.Tests/Orbit.Infrastructure.Tests.csproj --filter 'FullyQualifiedName~CalendarControllerTests' -v minimalpassed 15 tests.dotnet build Orbit.slnx -v minimalcompleted with zero errors.dotnet test -v minimalpassed all 8,148 tests.Handle_ShiftedMultiDayAlternateWeekRule_OmitsEventtest passed before changes:dotnet test tests/Orbit.Application.Tests --filter 'FullyQualifiedName~Handle_ShiftedMultiDayAlternateWeekRule_OmitsEvent' --no-restore.dotnet build Orbit.slnx --no-restorecompleted with zero errors, anddotnet test --no-restorepassed all 8,148 tests.Manual steps
None.