feat(09-01): add owner_user_id to notification_channels + event-key and subscription tables
- migrations/085: ALTER TABLE notification_channels ADD COLUMN owner_user_id TEXT REFERENCES user(id) ON DELETE CASCADE - migrations/085: partial unique index notification_channels_owner_user_id_channel_type_uniq WHERE owner_user_id IS NOT NULL (UPSERT race defense) - migrations/086: CREATE TABLE notify_event_keys (key PK, display_label, description, sort_order, is_active) with seed row - migrations/086: CREATE TABLE user_event_subscriptions composite PK (user_id, event_key, channel_type) opt-out model - lib/types/pipeline.ts: NotificationChannel gains owner_user_id: string | null - lib/types/pipeline.ts: exports NotifyEventKey and UserEventSubscription interfaces
This commit is contained in:
parent
4fc4a3d3b9
commit
b4f8ccac8b
3 changed files with 100 additions and 0 deletions
|
|
@ -44,6 +44,7 @@ export interface NotificationChannel {
|
|||
channel_type: ChannelType;
|
||||
config: Record<string, any>;
|
||||
is_active: boolean;
|
||||
owner_user_id: string | null;
|
||||
created_at: Date;
|
||||
updated_at: Date;
|
||||
}
|
||||
|
|
@ -169,3 +170,25 @@ export interface NotificationChannelInput {
|
|||
config: Record<string, any>;
|
||||
is_active?: boolean;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Phase 9 — Event taxonomy + user subscriptions
|
||||
// ============================================================================
|
||||
|
||||
export interface NotifyEventKey {
|
||||
key: string;
|
||||
display_label: string;
|
||||
description: string | null;
|
||||
sort_order: number;
|
||||
is_active: boolean;
|
||||
created_at: Date;
|
||||
updated_at: Date;
|
||||
}
|
||||
|
||||
export interface UserEventSubscription {
|
||||
user_id: string;
|
||||
event_key: string;
|
||||
channel_type: ChannelType;
|
||||
enabled: boolean;
|
||||
updated_at: Date;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue