feat: Replace Meetings with Calendar - events with types and assigned users

- Rename meetings table to events with type field (meeting/event)
- Add eventUsers junction table for user assignments
- Members see only events they're assigned to
- Calendar endpoint returns events + todos for month
- Add migration SQL for database changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
richardtekula
2025-12-15 10:50:31 +01:00
parent f828af562d
commit 3eb2f6ea02
10 changed files with 589 additions and 362 deletions

View File

@@ -0,0 +1,21 @@
-- Migration: Convert meetings to events with type and assigned users
-- Run this migration manually or via drizzle-kit
-- Step 1: Rename meetings table to events
ALTER TABLE meetings RENAME TO events;
-- Step 2: Add type column
ALTER TABLE events ADD COLUMN type TEXT NOT NULL DEFAULT 'meeting';
-- Step 3: Create event_users junction table
CREATE TABLE event_users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
event_id UUID NOT NULL REFERENCES events(id) ON DELETE CASCADE,
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
assigned_at TIMESTAMP DEFAULT NOW() NOT NULL,
UNIQUE(event_id, user_id)
);
-- Step 4: Assign existing events to their creators
INSERT INTO event_users (event_id, user_id)
SELECT id, created_by FROM events WHERE created_by IS NOT NULL;