diff --git a/apps/dashboard/src/routes/courses/[id]/lessons/[...lessonParams]/+page.svelte b/apps/dashboard/src/routes/courses/[id]/lessons/[...lessonParams]/+page.svelte
index 00d16bc5..bb26a056 100644
--- a/apps/dashboard/src/routes/courses/[id]/lessons/[...lessonParams]/+page.svelte
+++ b/apps/dashboard/src/routes/courses/[id]/lessons/[...lessonParams]/+page.svelte
@@ -13,7 +13,7 @@
import CourseIcon from '$lib/components/Icons/CourseIcon.svelte';
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
- import { Dropdown, Loading } from 'carbon-components-svelte';
+ import { Dropdown } from 'carbon-components-svelte';
import RoleBasedSecurity from '$lib/components/RoleBasedSecurity/index.svelte';
import PageNav from '$lib/components/PageNav/index.svelte';
import PageBody from '$lib/components/PageBody/index.svelte';
@@ -198,6 +198,7 @@
lesson.update((l) => ({
...l,
id: data.lessonId,
+ title: lessonData.title,
totalExercises,
totalComments: totalComments,
materials: {
diff --git a/supabase/migrations/20240811123634_lesson_section.sql b/supabase/migrations/20240811123634_lesson_section.sql
new file mode 100644
index 00000000..c988ba84
--- /dev/null
+++ b/supabase/migrations/20240811123634_lesson_section.sql
@@ -0,0 +1,127 @@
+create type "public"."COURSE_VERSION" as enum ('V1', 'V2');
+
+alter table "public"."lesson_language_history" drop constraint "lesson_language_history_lesson_language_id_fkey";
+
+alter table "public"."lesson_language" drop constraint "public_lesson_language_lesson_id_fkey";
+
+create table "public"."lesson_section" (
+ "id" uuid not null default gen_random_uuid(),
+ "created_at" timestamp with time zone not null default now(),
+ "updated_at" timestamp with time zone default now(),
+ "title" character varying,
+ "order" bigint default '0'::bigint,
+ "course_id" uuid
+);
+
+
+alter table "public"."lesson_section" enable row level security;
+
+alter table "public"."course" add column "version" "COURSE_VERSION" not null default 'V1'::"COURSE_VERSION";
+
+alter table "public"."lesson" add column "section_id" uuid;
+
+CREATE UNIQUE INDEX lesson_section_pkey ON public.lesson_section USING btree (id);
+
+alter table "public"."lesson_section" add constraint "lesson_section_pkey" PRIMARY KEY using index "lesson_section_pkey";
+
+alter table "public"."lesson" add constraint "public_lesson_section_id_fkey" FOREIGN KEY (section_id) REFERENCES lesson_section(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
+
+alter table "public"."lesson" validate constraint "public_lesson_section_id_fkey";
+
+alter table "public"."lesson_language_history" add constraint "public_lesson_language_history_lesson_language_id_fkey" FOREIGN KEY (lesson_language_id) REFERENCES lesson_language(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
+
+alter table "public"."lesson_language_history" validate constraint "public_lesson_language_history_lesson_language_id_fkey";
+
+alter table "public"."lesson_section" add constraint "public_lesson_section_course_id_fkey" FOREIGN KEY (course_id) REFERENCES course(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
+
+alter table "public"."lesson_section" validate constraint "public_lesson_section_course_id_fkey";
+
+alter table "public"."lesson_language" add constraint "public_lesson_language_lesson_id_fkey" FOREIGN KEY (lesson_id) REFERENCES lesson(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
+
+alter table "public"."lesson_language" validate constraint "public_lesson_language_lesson_id_fkey";
+
+grant delete on table "public"."lesson_section" to "anon";
+
+grant insert on table "public"."lesson_section" to "anon";
+
+grant references on table "public"."lesson_section" to "anon";
+
+grant select on table "public"."lesson_section" to "anon";
+
+grant trigger on table "public"."lesson_section" to "anon";
+
+grant truncate on table "public"."lesson_section" to "anon";
+
+grant update on table "public"."lesson_section" to "anon";
+
+grant delete on table "public"."lesson_section" to "authenticated";
+
+grant insert on table "public"."lesson_section" to "authenticated";
+
+grant references on table "public"."lesson_section" to "authenticated";
+
+grant select on table "public"."lesson_section" to "authenticated";
+
+grant trigger on table "public"."lesson_section" to "authenticated";
+
+grant truncate on table "public"."lesson_section" to "authenticated";
+
+grant update on table "public"."lesson_section" to "authenticated";
+
+grant delete on table "public"."lesson_section" to "service_role";
+
+grant insert on table "public"."lesson_section" to "service_role";
+
+grant references on table "public"."lesson_section" to "service_role";
+
+grant select on table "public"."lesson_section" to "service_role";
+
+grant trigger on table "public"."lesson_section" to "service_role";
+
+grant truncate on table "public"."lesson_section" to "service_role";
+
+grant update on table "public"."lesson_section" to "service_role";
+
+create policy "Enable read access for all users"
+on "public"."lesson_section"
+as permissive
+for select
+to public
+using (true);
+
+
+create policy "User must be an org member to DELETE"
+on "public"."lesson_section"
+as permissive
+for delete
+to public
+using (is_user_in_group_with_role(( SELECT course.group_id
+ FROM course
+ WHERE (course.id = lesson_section.course_id)
+ LIMIT 1)));
+
+
+create policy "User must be an org member to INSERT"
+on "public"."lesson_section"
+as permissive
+for insert
+to public
+with check (is_user_in_group_with_role(( SELECT course.group_id
+ FROM course
+ WHERE (course.id = lesson_section.course_id)
+ LIMIT 1)));
+
+
+create policy "User must be an org member to UPDATE"
+on "public"."lesson_section"
+as permissive
+for update
+to public
+using (is_user_in_group_with_role(( SELECT course.group_id
+ FROM course
+ WHERE (course.id = lesson_section.course_id)
+ LIMIT 1)))
+with check (is_user_in_group_with_role(( SELECT course.group_id
+ FROM course
+ WHERE (course.id = lesson_section.course_id)
+ LIMIT 1)));
\ No newline at end of file
diff --git a/supabase/seed.sql b/supabase/seed.sql
index 674852d0..aa1fda79 100644
--- a/supabase/seed.sql
+++ b/supabase/seed.sql
@@ -19,7 +19,7 @@ INSERT INTO "auth"."users" ("instance_id", "id", "aud", "role", "email", "encryp
-- Data for Name: identities; Type: TABLE DATA; Schema: auth; Owner: supabase_auth_admin
--
-INSERT INTO "auth"."identities" ("id", "user_id", "identity_data", "provider", "last_sign_in_at", "created_at", "updated_at") VALUES
+INSERT INTO "auth"."identities" ("provider_id", "user_id", "identity_data", "provider", "last_sign_in_at", "created_at", "updated_at") VALUES
('01676a50-bb56-4c5e-8a61-fb9e9190fb10', '01676a50-bb56-4c5e-8a61-fb9e9190fb10', '{"sub": "01676a50-bb56-4c5e-8a61-fb9e9190fb10", "email": "test@test.com"}', 'email', '2023-11-22 10:09:32.225444+00', '2023-11-22 10:09:32.225521+00', '2023-11-22 10:09:32.225521+00'),
('7ac00503-8519-43c8-a5ea-b79aeca900b1', '7ac00503-8519-43c8-a5ea-b79aeca900b1', '{"sub": "7ac00503-8519-43c8-a5ea-b79aeca900b1", "email": "admin@test.com"}', 'email', '2023-12-16 14:04:38.302264+00', '2023-12-16 14:04:38.302326+00', '2023-12-16 14:04:38.302326+00'),
('0c256e75-aa40-4f62-8d30-0217ca1c60d9', '0c256e75-aa40-4f62-8d30-0217ca1c60d9', '{"sub": "0c256e75-aa40-4f62-8d30-0217ca1c60d9", "email": "student@test.com"}', 'email', '2023-12-18 17:08:57.410285+00', '2023-12-18 17:08:57.410344+00', '2023-12-18 17:08:57.410344+00');