feat: Add i18n support, new content block types, course export, and lesson interaction tracking.

This commit is contained in:
2026-01-17 02:19:39 -03:00
parent b166387a48
commit 05faa20993
50 changed files with 3368 additions and 388 deletions
@@ -0,0 +1,16 @@
-- Create lesson_interactions table for engagement tracking
CREATE TABLE IF NOT EXISTS lesson_interactions (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
organization_id UUID NOT NULL,
user_id UUID NOT NULL,
lesson_id UUID NOT NULL,
video_timestamp FLOAT, -- Timestamp in seconds for video content
event_type VARCHAR(50) NOT NULL, -- 'heartbeat', 'pause', 'seek', 'complete', 'start'
metadata JSONB, -- Additional data (segment duration, playback speed, etc.)
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Index for efficient querying of heatmaps
CREATE INDEX IF NOT EXISTS idx_lesson_interactions_lesson_id ON lesson_interactions(lesson_id);
CREATE INDEX IF NOT EXISTS idx_lesson_interactions_user_id ON lesson_interactions(user_id);
CREATE INDEX IF NOT EXISTS idx_lesson_interactions_org_id ON lesson_interactions(organization_id);
@@ -0,0 +1,16 @@
-- Create notifications table for in-app alerts
CREATE TABLE IF NOT EXISTS notifications (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
organization_id UUID NOT NULL,
user_id UUID NOT NULL,
title VARCHAR(255) NOT NULL,
message TEXT NOT NULL,
notification_type VARCHAR(50) DEFAULT 'info', -- 'info', 'warning', 'success', 'deadline'
is_read BOOLEAN DEFAULT FALSE,
link_url VARCHAR(255), -- Optional link to redirect the user
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_notifications_user_id ON notifications(user_id);
CREATE INDEX IF NOT EXISTS idx_notifications_org_id ON notifications(organization_id);
CREATE INDEX IF NOT EXISTS idx_notifications_unread ON notifications(user_id) WHERE is_read = FALSE;