feat: Implement video play count tracking, refactor user update API, add missing CMS delete functions, and update database transaction handling.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
-- Migration: Add missing delete functions
|
||||
-- Adds fn_delete_module and fn_delete_lesson which were missing from the CRUD migration
|
||||
|
||||
CREATE OR REPLACE FUNCTION fn_delete_module(
|
||||
p_id UUID,
|
||||
p_organization_id UUID
|
||||
) RETURNS BOOLEAN AS $$
|
||||
DECLARE
|
||||
v_deleted_count INTEGER;
|
||||
BEGIN
|
||||
DELETE FROM modules
|
||||
WHERE id = p_id AND organization_id = p_organization_id;
|
||||
|
||||
GET DIAGNOSTICS v_deleted_count = ROW_COUNT;
|
||||
RETURN v_deleted_count > 0;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION fn_delete_lesson(
|
||||
p_id UUID,
|
||||
p_organization_id UUID
|
||||
) RETURNS BOOLEAN AS $$
|
||||
DECLARE
|
||||
v_deleted_count INTEGER;
|
||||
BEGIN
|
||||
DELETE FROM lessons
|
||||
WHERE id = p_id AND organization_id = p_organization_id;
|
||||
|
||||
GET DIAGNOSTICS v_deleted_count = ROW_COUNT;
|
||||
RETURN v_deleted_count > 0;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
Reference in New Issue
Block a user