feat(activity): per-tenant audit feed in notification dropdown

activity_events records booking lifecycle transitions with the actor
behind each change — staff (dashboard), customer (self-service), or
system (auto-promotion). The notification dropdown leads with the real
feed instead of derived recent-booking guesses.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Tomas DvorakandDevin committed 2026-09-18 16:06:13 +02:00
1 parent e5cb9bd543
commit d86cba61e3
18 files changed
+634 -28

No files matched your search

@@ -0,0 +1,21 @@
-- +goose Up
-- Per-tenant activity feed: who changed what. Actor kinds distinguish
-- dashboard users (staff), public self-service actions (customer), and
-- automatic transitions (system). Kept to booking lifecycle events in v1.
CREATE TABLE activity_events (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id uuid NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
actor_kind text NOT NULL DEFAULT 'staff',
actor_subject text NOT NULL DEFAULT '',
actor_name text NOT NULL DEFAULT '',
action text NOT NULL,
entity_type text NOT NULL DEFAULT 'booking',
entity_id uuid,
summary text NOT NULL DEFAULT '',
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX activity_events_tenant_created_idx
ON activity_events (tenant_id, created_at DESC);
-- +goose Down
DROP TABLE IF EXISTS activity_events;