Skip to content

feat(views): kanban + calendar presentation config — backend (#2059) - #2063

Merged
rubenvdlinde merged 1 commit into
developmentfrom
wip/build-object-views-backend
Jul 24, 2026
Merged

feat(views): kanban + calendar presentation config — backend (#2059)#2063
rubenvdlinde merged 1 commit into
developmentfrom
wip/build-object-views-backend

Conversation

@rubenvdlinde

@rubenvdlinde rubenvdlinde commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Backend phase of openspec/changes/object-views-kanban-calendar (#2059). This is NOT the full feature — it lands the server-side contract only; the nc-vue component phase (CnObjectKanban/CnObjectCalendar + src/views/ dispatch on presentation.viewType) is phase 2 and remains after this PR. Do not close #2059.

  • lib/Db/View.php: nullable presentation JSON property (viewType: table|kanban|calendar + kanban/calendar config), defaulted to table when null so existing views are unchanged. Migration Version1Date20260724000000 adds the column (idempotent, nullable).
  • lib/Service/ViewService.php: create()/update() accept/validate/persist presentation; groupByField/dateField/endDateField are validated against the view's schema properties and an unrenderable config is rejected with InvalidArgumentException.
  • lib/Controller/ViewsController.php: create/update/patch pass presentation through (400 on validation failure); two new read-only endpoints — GET /api/views/{id}/kanban and GET /api/views/{id}/calendar?start=&end=.
  • lib/Service/ViewPresentationService.php (new): kanban column derivation (explicit columnOrder > schema enum order > facet-discovered distinct values) with cards paginated per column through the existing ObjectService::searchObjectsPaginated(); calendar date-range query (+ optional endDateField spanning) over the same existing object-query surface.
  • Drag-to-move deliberately has no new endpoint — it continues to go through the existing guarded object PATCH/PUT (RBAC + x-openregister-lifecycle), asserted by a dedicated test rather than re-implemented.
  • Fixed a pre-existing bug surfaced by the new tests: View::hydrate() called Entity's magic-__call setters with named arguments (setUuid(uuid: null)), which silently resolves to an undefined $args[0] and crashes on the non-nullable isPublic field. Rewritten to the field-map + dynamic-method-call pattern already used elsewhere (e.g. Agent::hydrate()).

Test plan

  • tests/Unit/Db/ViewTest.php, tests/Unit/Service/ViewServiceTest.php, tests/Unit/Service/ViewPresentationServiceTest.php, tests/Unit/Controller/ViewsControllerTest.php — 123 tests / 270 assertions, green in nextcloud:34.0.0-apache.
  • phpcs clean on all changed/added lib/ files.
  • Legacy-view-unchanged, validation-rejects-unrenderable-config, enum/columnOrder/facet column derivation, pagination-per-column, and calendar range+spanning behavior all covered by unit tests.
  • Phase 2 (tasks 4.1, 5.2 — nc-vue components + live smoke on 8080) — left unchecked in tasks.md for the follow-up change.

Adds the backend contract for object-views-kanban-calendar: a nullable
`presentation` JSON column on View (viewType table|kanban|calendar +
kanban/calendar config), validated on create/update against the view's
schema properties, kanban column derivation (enum order/columnOrder/
facet-discovered distinct values) with per-column paginated cards, and
a calendar date-range object query with optional endDateField spanning.
Two new read-only endpoints (GET /api/views/{id}/kanban and .../calendar)
expose this to the frontend phase; drag-to-move deliberately has no new
endpoint and continues to go through the existing guarded object
PATCH/PUT path, asserted by a dedicated test.

Also fixes a pre-existing bug in View::hydrate(): calling Entity's
magic-__call setters with named arguments (setUuid(uuid: null)) silently
resolves to an undefined $args[0], which the new presentation tests
surfaced as a hard crash on the non-nullable isPublic field. Rewritten
to the field-map + dynamic-method-call pattern already used elsewhere
(e.g. Agent::hydrate()).

Frontend/nc-vue phase (CnObjectKanban/CnObjectCalendar components, the
src/views/ viewType dispatch, and the live smoke test) is phase 2 and
intentionally left for a follow-up change; tasks.md reflects this.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ ca1b837

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
composer ✅ 172/172
npm
PHPUnit ⏭️
Newman ⏭️
Playwright ⏭️

Quality workflow — 2026-07-24 11:52 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde
rubenvdlinde merged commit d581a82 into development Jul 24, 2026
15 of 24 checks passed
@rubenvdlinde
rubenvdlinde deleted the wip/build-object-views-backend branch July 24, 2026 11:53
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.

1 participant