feat: Add LTI launch, lesson preview, course progress, bookmarks, and asset management features.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
-- Migration to support course previews and multi-instructor sync
|
||||
ALTER TABLE lessons ADD COLUMN is_previewable BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
CREATE TABLE course_instructors (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
course_id UUID NOT NULL REFERENCES courses(id) ON DELETE CASCADE,
|
||||
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
role TEXT NOT NULL DEFAULT 'instructor',
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
UNIQUE(course_id, user_id)
|
||||
);
|
||||
@@ -0,0 +1,15 @@
|
||||
-- Create user_bookmarks table for students to save lessons
|
||||
CREATE TABLE IF NOT EXISTS user_bookmarks (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
organization_id UUID NOT NULL,
|
||||
user_id UUID NOT NULL,
|
||||
course_id UUID NOT NULL,
|
||||
lesson_id UUID NOT NULL,
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
||||
UNIQUE(user_id, lesson_id)
|
||||
);
|
||||
|
||||
-- Index for efficient querying
|
||||
CREATE INDEX IF NOT EXISTS idx_user_bookmarks_user_id ON user_bookmarks(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_user_bookmarks_course_id ON user_bookmarks(course_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_user_bookmarks_org_id ON user_bookmarks(organization_id);
|
||||
@@ -0,0 +1,35 @@
|
||||
-- Migration: Add LTI 1.3 tables
|
||||
|
||||
CREATE TABLE IF NOT EXISTS lti_registrations (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
organization_id UUID NOT NULL REFERENCES organizations(id),
|
||||
issuer TEXT NOT NULL,
|
||||
client_id TEXT NOT NULL,
|
||||
deployment_id TEXT NOT NULL,
|
||||
auth_token_url TEXT NOT NULL,
|
||||
auth_login_url TEXT NOT NULL,
|
||||
jwks_url TEXT NOT NULL,
|
||||
platform_name TEXT,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
UNIQUE(issuer, client_id, deployment_id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS lti_nonces (
|
||||
nonce TEXT PRIMARY KEY,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Delete nonces older than 1 hour (can be run via cron or during launch)
|
||||
-- DELETE FROM lti_nonces WHERE created_at < NOW() - INTERVAL '1 hour';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS lti_resource_links (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
organization_id UUID NOT NULL REFERENCES organizations(id),
|
||||
resource_link_id TEXT NOT NULL,
|
||||
course_id UUID NOT NULL REFERENCES courses(id),
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
UNIQUE(organization_id, resource_link_id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_lti_registrations_issuer_client ON lti_registrations(issuer, client_id);
|
||||
Reference in New Issue
Block a user