docs(10-02): complete event mutation plan

This commit is contained in:
Arthur Belleville 2026-05-16 00:33:33 +02:00
parent 614003f165
commit 0dc0e8978f
No known key found for this signature in database
3 changed files with 113 additions and 6 deletions

View file

@ -14,7 +14,7 @@
|---|-------|------|--------------|
| 8 | Social Sign-in | Google sign-in creates/links local users and issues existing Xtablo sessions; Apple sign-in is disabled | AUTH-08..13 |
| 9 | Etapes | Tasks can be grouped under one-level etapes without breaking the kanban model | ETAPE-01..06 |
| 10 | 1/4 | In Progress| |
| 10 | 2/4 | In Progress| |
| 11 | Individual Planning | Users can view their own event agenda across tablos | PLAN-01..04 |
| 12 | Native Tablo Chat | Each tablo has persisted discussion with real-time delivery and no managed chat provider | CHAT-01..06 |

View file

@ -3,14 +3,14 @@ gsd_state_version: 1.0
milestone: v2.0
milestone_name: Collaboration, planning, and social sign-in
status: executing
last_updated: "2026-05-15T22:29:24.395Z"
last_updated: "2026-05-15T22:33:27.007Z"
last_activity: 2026-05-15
progress:
total_phases: 5
completed_phases: 2
total_plans: 13
completed_plans: 10
percent: 77
completed_plans: 11
percent: 85
---
# STATE
@ -29,10 +29,10 @@ See: `.planning/PROJECT.md` (updated 2026-05-15)
## Current Position
Phase: 10 (events) — EXECUTING
Plan: 2 of 4
Plan: 3 of 4
Status: Ready to execute
Last activity: 2026-05-15
Resume file: .planning/phases/10-events/10-02-PLAN.md
Resume file: .planning/phases/10-events/10-03-PLAN.md
## Phase Status

View file

@ -0,0 +1,107 @@
---
phase: 10-events
plan: 02
subsystem: events
tags: [events, postgres, sqlc, htmx, templ]
requires:
- phase: 10-events
provides: Plan 01 event schema, calendar tab, create form, and create/list routes
provides:
- Parent-scoped event edit form and update handler
- Hard-delete event flow with inline confirmation
- Event mutation authorization through loadOwnedEvent
- Update validation for required fields and end-after-start time ordering
affects: [events, tablo-detail, calendar]
tech-stack:
added: []
patterns:
- "loadOwnedEvent composes loadOwnedTablo with child lookup scoped by tablo_id"
- "Inline edit and delete fragments target #event-form-slot and refresh #events-tab after mutation"
key-files:
created: []
modified:
- backend/internal/db/queries/events.sql
- backend/internal/web/handlers_events_test.go
- backend/internal/web/handlers_events.go
- backend/internal/web/router.go
- backend/templates/events.templ
- backend/templates/events_forms.go
key-decisions:
- "Delete is a hard delete through DELETE FROM events with no deleted_at field."
- "Update reuses the create form parser so create and edit enforce the same date/time validation."
- "Mutation routes load the parent tablo first and then fetch the child event by id plus tablo_id."
patterns-established:
- "Event mutation handlers return 404 for inaccessible parent or child resources."
- "Event edit validation errors re-render the edit form into #event-form-slot with status 422."
requirements-completed: [EVENT-01, EVENT-02, EVENT-04, EVENT-05]
duration: ~18min
completed: 2026-05-15
---
# Phase 10: Events Plan 02 Summary
**Inline event edit, update validation, and hard delete for tablo-owned calendar events**
## Performance
- **Duration:** ~18 min
- **Started:** 2026-05-15T22:29:00Z
- **Completed:** 2026-05-15T22:47:00Z
- **Tasks:** 2
- **Files modified:** 6
## Accomplishments
- Added DB-backed RED coverage for edit rendering, update success, update validation, delete, and non-owner mutation denial.
- Added `UpdateEvent` and `DeleteEvent` SQLC queries scoped by both `id` and `tablo_id`.
- Added `loadOwnedEvent` plus edit, update, delete-confirm, and delete handlers.
- Added inline edit and delete confirmation fragments using the planned UI copy.
## Task Commits
Each task was committed atomically:
1. **Task 1: Add RED coverage for edit, update, delete, and ownership** - `e5f083d` (test)
2. **Task 2: Implement inline edit and hard delete** - `614003f` (feat)
## Files Created/Modified
- `backend/internal/db/queries/events.sql` - Adds update and hard-delete queries.
- `backend/internal/web/handlers_events_test.go` - Covers edit, update, delete, validation, and ownership behavior.
- `backend/internal/web/handlers_events.go` - Adds owned-event loading and mutation handlers.
- `backend/internal/web/router.go` - Mounts event edit, update, delete-confirm, and delete routes.
- `backend/templates/events.templ` - Adds edit form and delete confirmation fragments.
- `backend/templates/events_forms.go` - Adds URL helpers for event mutation routes.
## Decisions Made
- Update and delete are always scoped to the owned parent tablo before touching the event row.
- Delete is a hard delete, matching the plan's no-restore requirement.
- Edit uses a separate fragment from create so labels, button copy, and validation rerendering remain clear.
## Deviations from Plan
None - plan executed as written.
## Issues Encountered
None.
## User Setup Required
None - no external service configuration required.
## Next Phase Readiness
The event CRUD surface is complete. Plan 10-03 can add direct-link and month query handling refinements on top of the existing Events tab and mutation routes.
---
*Phase: 10-events*
*Completed: 2026-05-15*