108 lines
3.7 KiB
Markdown
108 lines
3.7 KiB
Markdown
|
|
---
|
||
|
|
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*
|