Repository: tutur3u/platform
Pull request #2768: Fix Course Management bugs
Author: login: Henry7482
Created: 2025-05-10T15:21:07Z | Merged: 2025-05-11T13:07:54Z

### This PR includes:
- Add 'description' column for courses in supabase
- Add a div for Course Description
- Copy api for Flashcard Generation
- Set dynamic sizing for Module Video preview
- Add delete confirmation for module
### Notes:
- Please double check the database by creating a course (to ensure that the description column has been added)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Added support for creating, updating, and deleting workspace flashcards via new API endpoints.
  - Introduced an AI-powered flashcard generation API endpoint.
  - Added the ability to display course descriptions in course details.

- **Improvements**
  - Embedded YouTube videos now have improved responsive layout and aspect ratio handling.
  - Added a confirmation dialog before deleting a workspace course module for safer user actions.
  - Enhanced course editing form to handle empty course descriptions gracefully.
  - Extended environment variable support for Google Vertex authentication.

- **Bug Fixes**
  - Ensured course descriptions display a fallback message if no description is available.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


Diff:
diff --git a/apps/db/supabase/migrations/20250511120347_new_migration.sql b/apps/db/supabase/migrations/20250511120347_new_migration.sql
new file mode 100644
index 0000000000..418e8816ba
--- /dev/null
+++ b/apps/db/supabase/migrations/20250511120347_new_migration.sql
@@ -0,0 +1,3 @@
+alter table "public"."workspace_courses" add column "description" text default ''::text;
+
+
diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/layout.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/layout.tsx
index b4acfd2207..367bfa0692 100644
--- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/layout.tsx
+++ b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/layout.tsx
@@ -39,6 +39,7 @@ export default async function CourseDetailsLayout({ children, params }: Props) {
             </Link>
           </h1>
         }
+        description={<div>{data.description || t('common.unknown')}</div>}
       />
       <Separator className="my-4" />
       {children}
diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx
index 8bbbe39dd9..ca40c2a106 100644
--- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx
+++ b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx
@@ -5,13 +5,11 @@ export const YoutubeEmbed = ({ embedId }: { embedId: string | undefined }) => {
 
   return embedId ? (
     <iframe
-      width="853"
-      height="480"
       src={`https://www.youtube.com/embed/${embedId}`}
       allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
       allowFullScreen
       title="Embedded youtube"
-      className="aspect-video h-48 w-full rounded-lg md:h-64 lg:h-96"
+      className="h-full w-full rounded-lg"
     />
   ) : (
     <div>{t('ws-course-modules.invalid_youtube_link')}.</div>
diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/page.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/page.tsx
index 09aa3f8933..c67af761f9 100644
--- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/page.tsx
+++ b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/page.tsx
@@ -67,7 +67,9 @@ export default async function ModuleYoutubeLinksPage({ params }: Props) {
               {link}
             </Link>
             <Separator className="my-2" />
-            <YoutubeEmbed key={index} embedId={extractYoutubeId(link)} />
+            <div className="aspect-video w-full">
+              <YoutubeEmbed key={index} embedId={extractYoutubeId(link)} />
+            </div>
           </div>
         ))}
     </div>
diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/row-actions.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/row-actions.tsx
index 4f8714e605..657b931592 100644
--- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/row-actions.tsx
+++ b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/row-actions.tsx
@@ -33,6 +33,7 @@ export function WorkspaceCourseModuleRowActions({
   const t = useTranslations();
 
   const data = row.original;
+  const [showDeleteDialog, setShowDeleteDialog] = useState(false);
 
   const deleteWorkspaceCourseModule = async () => {
     const res = await fetch(
@@ -83,7 +84,7 @@ export function WorkspaceCourseModuleRowActions({
             {t('common.edit')}
           </DropdownMenuItem>
           <DropdownMenuSeparator />
-          <DropdownMenuItem onClick={deleteWorkspaceCourseModule}>
+          <DropdownMenuItem onClick={() => setShowDeleteDialog(true)}>
             {t('common.delete')}
           </DropdownMenuItem>
         </DropdownMenuContent>
@@ -103,6 +104,27 @@ export function WorkspaceCourseModuleRowActions({
           />
         }
       />
+
+      <ModifiableDialogTrigger
+        data={data}
+        open={showDeleteDialog}
+        title={t('ws-courses.delete_confirm_title', { name: data.name })}
+        editDescription={t('common.confirm_delete_description')}
+        setOpen={setShowDeleteDialog}
+        form={
+          <div className="flex justify-end gap-2 pt-4">
+            <Button
+              variant="outline"
+              onClick={() => setShowDeleteDialog(false)}
+            >
+              {t('common.cancel')}
+            </Button>
+            <Button variant="destructive" onClick={deleteWorkspaceCourseModule}>
+              {t('common.delete')}
+            </Button>
+          </div>
+        }
+      />
     </div>
   );
 }
diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/mock/mock-courses.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/mock/mock-courses.tsx
deleted file mode 100644
index 80770a6a79..0000000000
--- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/mock/mock-courses.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import type { WorkspaceCourse } from '@tuturuuu/types/db';
-
-export const mockData = (): WorkspaceCourse[] => [
-  {
-    id: '1',
-    name: 'Course 1',
-    created_at: '2025-05-02T12:00:00Z',
-    is_public: true,
-    is_published: true,
-    ws_id: 'ws_1',
-    href: '/ws_1/courses/1',
-  },
-  {
-    id: '2',
-    name: 'Course 2',
-    created_at: '2025-05-01T12:00:00Z',
-    is_public: false,
-    is_published: true,
-    ws_id: 'ws_1',
-    href: '/ws_1/courses/2',
-  },
-  {
-    id: '3',
-    name: 'Course 3',
-    created_at: '2025-04-30T12:00:00Z',
-    is_public: true,
-    is_published: false,
-    ws_id: 'ws_1',
-    href: '/ws_1/courses/3',
-  },
-];
diff --git a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/row-actions.tsx b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/row-actions.tsx
index fa4850f599..c6b1b67223 100644
--- a/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/row-actions.tsx
+++ b/apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/row-actions.tsx
@@ -101,7 +101,12 @@ export function WorkspaceCourseRowActions({
         title={t('ws-flashcards.edit')}
         editDescription={t('ws-flashcards.edit_description')}
         setOpen={setShowEditDialog}
-        form={<WorkspaceCourseForm wsId={data.ws_id} data={data} />}
+        form={
+          <WorkspaceCourseForm
+            wsId={data.ws_id}
+            data={{ ...data, description: data.description ?? '' }}
+          />
+        }
       />
 
       <ModifiableDialogTrigger
diff --git a/apps/upskii/src/app/api/ai/objects/flashcards/route.ts b/apps/upskii/src/app/api/ai/objects/flashcards/route.ts
new file mode 100644
index 0000000000..18f789576f
--- /dev/null
+++ b/apps/upskii/src/app/api/ai/objects/flashcards/route.ts
@@ -0,0 +1,9 @@
+import { POST } from '@tuturuuu/ai/object/flashcards/route';
+
+export const config = {
+  maxDuration: 60,
+  preferredRegion: 'sin1',
+  runtime: 'edge',
+};
+
+export { POST };
diff --git a/apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/[flashcardId]/route.ts b/apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/[flashcardId]/route.ts
new file mode 100644
index 0000000000..5a73ba4886
--- /dev/null
+++ b/apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/[flashcardId]/route.ts
@@ -0,0 +1,51 @@
+import { createClient } from '@tuturuuu/supabase/next/server';
+import { NextResponse } from 'next/server';
+
+interface Params {
+  params: Promise<{
+    flashcardId: string;
+  }>;
+}
+
+export async function PUT(req: Request, { params }: Params) {
+  const supabase = await createClient();
+
+  // eslint-disable-next-line no-unused-vars
+  const { moduleId: _, ...rest } = await req.json();
+  const { flashcardId: id } = await params;
+
+  const { error } = await supabase
+    .from('workspace_flashcards')
+    .update(rest)
+    .eq('id', id);
+
+  if (error) {
+    console.log(error);
+    return NextResponse.json(
+      { message: 'Error updating workspace flashcard' },
+      { status: 500 }
+    );
+  }
+
+  return NextResponse.json({ message: 'success' });
+}
+
+export async function DELETE(_: Request, { params }: Params) {
+  const supabase = await createClient();
+  const { flashcardId: id } = await params;
+
+  const { error } = await supabase
+    .from('workspace_flashcards')
+    .delete()
+    .eq('id', id);
+
+  if (error) {
+    console.log(error);
+    return NextResponse.json(
+      { message: 'Error deleting workspace flashcard' },
+      { status: 500 }
+    );
+  }
+
+  return NextResponse.json({ message: 'success' });
+}
diff --git a/apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts b/apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts
new file mode 100644
index 0000000000..f8dccc1654
--- /dev/null
+++ b/apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts
@@ -0,0 +1,62 @@
+import { createClient } from '@tuturuuu/supabase/next/server';
+import { NextResponse } from 'next/server';
+
+interface Params {
+  params: Promise<{
+    wsId: string;
+  }>;
+}
+
+export async function GET(_: Request, { params }: Params) {
+  const supabase = await createClient();
+  const { wsId: id } = await params;
+
+  const { data, error } = await supabase
+    .from('workspace_flashcards')
+    .select('*')
+    .eq('ws_id', id)
+    .single();
+
+  if (error) {
+    console.log(error);
+    return NextResponse.json(
+      { message: 'Error fetching workspace flashcards' },
+      { status: 500 }
+    );
+  }
+
+  return NextResponse.json(data);
+}
+
+export async function POST(req: Request, { params }: Params) {
+  const supabase = await createClient();
+  const { wsId: id } = await params;
+
+  const { moduleId, ...rest } = await req.json();
+
+  const { data, error } = await supabase
+    .from('workspace_flashcards')
+    .insert({
+      ...rest,
+      ws_id: id,
+    })
+    .select('id')
+    .single();
+
+  if (error) {
+    console.log(error);
+    return NextResponse.json(
+      { message: 'Error creating workspace flashcard' },
+      { status: 500 }
+    );
+  }
+
+  if (moduleId) {
+    await supabase.from('course_module_flashcards').insert({
+      module_id: moduleId,
+      flashcard_id: data.id,
+    });
+  }
+
+  return NextResponse.json({ message: 'success' });
+}
diff --git a/packages/types/src/primitives/UserGroup.ts b/packages/types/src/primitives/UserGroup.ts
index 7c6bfbf672..d734386c7f 100644
--- a/packages/types/src/primitives/UserGroup.ts
+++ b/packages/types/src/primitives/UserGroup.ts
@@ -6,4 +6,5 @@ export interface UserGroup extends Entity {
   amount?: number;
   sessions?: string[];
   href?: string;
+  description?: string;
 }
diff --git a/packages/types/src/supabase.ts b/packages/types/src/supabase.ts
index 874aa9d9a6..8b3c57d248 100644
--- a/packages/types/src/supabase.ts
+++ b/packages/types/src/supabase.ts
@@ -4653,6 +4653,7 @@ export type Database = {
       workspace_courses: {
         Row: {
           created_at: string;
+          description: string | null;
           id: string;
           is_public: boolean;
           is_published: boolean;
@@ -4661,6 +4662,7 @@ export type Database = {
         };
         Insert: {
           created_at?: string;
+          description?: string | null;
           id?: string;
           is_public?: boolean;
           is_published?: boolean;
@@ -4669,6 +4671,7 @@ export type Database = {
         };
         Update: {
           created_at?: string;
+          description?: string | null;
           id?: string;
           is_public?: boolean;
           is_published?: boolean;
diff --git a/turbo.json b/turbo.json
index a1dba2806a..11373c34bb 100644
--- a/turbo.json
+++ b/turbo.json
@@ -16,6 +16,10 @@
     "GOOGLE_GENERATIVE_AI_API_KEY",
     "GOOGLE_VERTEX_PROJECT",
     "GOOGLE_VERTEX_LOCATION",
+    "GOOGLE_VERTEX_EMAIL",
+    "GOOGLE_VERTEX_CLIENT_ID",
+    "GOOGLE_VERTEX_PRIVATE_KEY",
+    "GOOGLE_VERTEX_PRIVATE_KEY_ID",
     "GOOGLE_APPLICATION_CREDENTIALS",
     "DEFAULT_AI_MODEL",
     "CF_ACCOUNT_ID",


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 5**

<details>
<summary>🧹 Nitpick comments (3)</summary><blockquote>

<details>
<summary>apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/[flashcardId]/route.ts (3)</summary><blockquote>

`10-31`: **Enhance error handling for the PUT endpoint**

The implementation correctly updates flashcard data while excluding the moduleId field. However, consider improving the error handling beyond console logging for production environments.


```diff
 if (error) {
   console.log(error);
+  // Consider using a structured logging approach instead of console.log
+  // logger.error('Error updating workspace flashcard', { error, flashcardId: id });
   return NextResponse.json(
     { message: 'Error updating workspace flashcard' },
     { status: 500 }
   );
 }
```

---

`33-51`: **Enhance error handling for the DELETE endpoint**

The implementation correctly handles deletion of flashcards. Similar to the PUT endpoint, consider improving error handling beyond console logging.


```diff
 if (error) {
   console.log(error);
+  // Consider using a structured logging approach instead of console.log
+  // logger.error('Error deleting workspace flashcard', { error, flashcardId: id });
   return NextResponse.json(
     { message: 'Error deleting workspace flashcard' },
     { status: 500 }
   );
 }
```

---

`4-8`: **Consider using non-async params**

The params interface is using a Promise type, but it could be simplified since the actual usage later isn't asynchronous.


```diff
 interface Params {
-  params: Promise<{
+  params: {
     flashcardId: string;
-  }>;
+  };
 }
```

Then update the usage in the handlers:

```diff
- const { flashcardId: id } = await params;
+ const { flashcardId: id } = params;
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 6bf44ef840db3fe56bf55efdee5eea8deec5e8d2 and cf22a8f5e731835b40eaea36e917ea71a584d781.

</details>

<details>
<summary>📒 Files selected for processing (8)</summary>

* `apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/layout.tsx` (1 hunks)
* `apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx` (1 hunks)
* `apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/page.tsx` (1 hunks)
* `apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/row-actions.tsx` (3 hunks)
* `apps/upskii/src/app/api/ai/objects/flashcards/route.ts` (1 hunks)
* `apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/[flashcardId]/route.ts` (1 hunks)
* `apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts` (1 hunks)
* `packages/types/src/supabase.ts` (3 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧬 Code Graph Analysis (1)</summary>

<details>
<summary>apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/page.tsx (1)</summary><blockquote>

<details>
<summary>apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx (1)</summary>

* `YoutubeEmbed` (3-17)

</details>

</blockquote></details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (1)</summary>

* GitHub Check: Analyze (javascript-typescript)

</details>

<details>
<summary>🔇 Additional comments (9)</summary><blockquote>

<details>
<summary>apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/page.tsx (1)</summary>

`70-72`: **Good implementation of responsive video container**

The addition of a wrapper div with `aspect-video w-full` classes ensures videos maintain their proper 16:9 aspect ratio while being fully responsive across different screen sizes. This implementation works well with the updated `YoutubeEmbed` component that now uses relative sizing.

</details>
<details>
<summary>apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx (1)</summary>

`12-12`: **Good responsive styling approach**

Updating the iframe's className to use relative sizing (`w-full h-full`) instead of fixed dimensions allows the component to adapt properly to its container. This change complements the aspect-ratio container added in the page component, creating a robust responsive video embedding solution.

</details>
<details>
<summary>packages/types/src/supabase.ts (1)</summary>

`4656-4656`: **Great addition of the description field to the workspace_courses table!**

This change properly adds the optional description field to all relevant interfaces (Row, Insert, Update), enabling course descriptions to be stored and displayed in the UI as mentioned in the PR objectives.



Also applies to: 4665-4665, 4674-4674

</details>
<details>
<summary>apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/layout.tsx (1)</summary>

`42-42`: **LGTM: Course description enhancement**

This change appropriately adds the course description to the FeatureSummary component, matching the pattern used for the title with a proper fallback when description is missing.

</details>
<details>
<summary>apps/upskii/src/app/api/ai/objects/flashcards/route.ts (1)</summary>

`1-9`: **API handler properly configured with appropriate runtime settings**

The implementation correctly re-exports the POST handler from the AI flashcards package with suitable runtime configuration. The 60-second timeout is appropriate for AI operations that may take longer than standard requests.

</details>
<details>
<summary>apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/row-actions.tsx (3)</summary>

`36-36`: **Good addition of state for delete confirmation dialog**

Adding this state variable improves user experience by enabling confirmation before deletion.

---

`87-87`: **Improved safety with confirmation dialog trigger**

Changing to show a confirmation dialog instead of deleting immediately is a good UX improvement.

---

`108-127`: **Well-structured deletion confirmation dialog**

The implementation follows the same pattern as the edit dialog and provides clear options for users to cancel or confirm deletion.

</details>
<details>
<summary>apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts (1)</summary>

`1-9`: **LGTM! Good organization of imports and type definitions.**

The imports are clean and focused, and the Params interface is well-defined for route parameters.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-10T15:25:48Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 1**

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between d839e49e034f09948714ab54daa17370baf72628 and 38b92e01b53d6280575c83a01f89ce933c42a4f7.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 GitHub Check: codecov/patch</summary>

<details>
<summary>apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx</summary>

[warning] 12-12: apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx#L12
Added line #L12 was not covered by tests

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (9)</summary>

* GitHub Check: Analyze (javascript-typescript)
* GitHub Check: Deploy-Preview
* GitHub Check: Prettier Check (23)
* GitHub Check: Deploy-Preview
* GitHub Check: Verify generated types
* GitHub Check: Deploy-Preview
* GitHub Check: Deploy-Preview
* GitHub Check: Deploy-Preview
* GitHub Check: Deploy-Preview

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-10T15:48:33Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 1**

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 38b92e01b53d6280575c83a01f89ce933c42a4f7 and a5a9b617bd27d26f520c03080604273088924ab9.

</details>

<details>
<summary>📒 Files selected for processing (2)</summary>

* `apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/row-actions.tsx` (1 hunks)
* `turbo.json` (4 hunks)

</details>

<details>
<summary>✅ Files skipped from review due to trivial changes (1)</summary>

* turbo.json

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 GitHub Check: codecov/patch</summary>

<details>
<summary>apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/row-actions.tsx</summary>

[warning] 104-104: apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/row-actions.tsx#L104
Added line #L104 was not covered by tests

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (9)</summary>

* GitHub Check: Analyze (javascript-typescript)
* GitHub Check: Deploy-Preview
* GitHub Check: Deploy-Preview
* GitHub Check: Verify generated types
* GitHub Check: Deploy-Preview
* GitHub Check: Deploy-Preview
* GitHub Check: Deploy-Preview
* GitHub Check: Deploy-Preview
* GitHub Check: Prettier Check (23)

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-10T16:11:22Z
user: login: vhpx
body: Course description is added, but missing migration file to ensure the database correctly contains the new field.
state: CHANGES_REQUESTED
author_association: MEMBER
submitted_at: 2025-05-10T18:19:53Z
user: login: vhpx
body: LGTM! Thanks @Henry7482.
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-11T13:06:25Z

Review comments:
diff_hunk: @@ -0,0 +1,62 @@
+import { createClient } from '@tuturuuu/supabase/next/server';
+import { NextResponse } from 'next/server';
+
+interface Params {
+  params: Promise<{
+    wsId: string;
+  }>;
+}
+
+export async function GET(_: Request, { params }: Params) {
+  const supabase = await createClient();
+  const { wsId: id } = await params;
+
+  const { data, error } = await supabase
+    .from('workspace_flashcards')
+    .select('*')
+    .eq('ws_id', id)
+    .single();
+
+  if (error) {
+    console.log(error);
+    return NextResponse.json(
+      { message: 'Error fetching workspace flashcards' },
+      { status: 500 }
+    );
+  }
+
+  return NextResponse.json(data);
+}
+
+export async function POST(req: Request, { params }: Params) {
+  const supabase = await createClient();
+  const { wsId: id } = await params;
+
+  const { moduleId, ...rest } = await req.json();
+
+  const { data, error } = await supabase
+    .from('workspace_flashcards')
+    .insert({
+      ...rest,
+      ws_id: id,
+    })
+    .select('id')
+    .single();
+
+  if (error) {
+    console.log(error);
+    return NextResponse.json(
+      { message: 'Error creating workspace flashcard' },
+      { status: 500 }
+    );
+  }
path: apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Error handling needs improvement**

The current error handling only logs to the console, which is insufficient for production environments.

Consider implementing more robust error handling:

```diff
if (error) {
-  console.log(error);
+  console.error('Failed to create flashcard:', error);
  return NextResponse.json(
    { message: 'Error creating workspace flashcard' },
    { status: 500 }
  );
}
```

For production, consider integrating with a proper error monitoring service.


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
  if (error) {
    console.error('Failed to create flashcard:', error);
    return NextResponse.json(
      { message: 'Error creating workspace flashcard' },
      { status: 500 }
    );
  }
`````

</details>

<!-- suggestion_end -->

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts around lines
46 to 52, the error handling currently only logs errors to the console, which is
inadequate for production. Replace the console.log with a proper logging
mechanism that records error details in a structured way, and consider
integrating an error monitoring service to capture and alert on these errors.
Ensure the error response still returns a 500 status with a clear message, but
improve internal error tracking for better observability.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-10T15:25:47Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,62 @@
+import { createClient } from '@tuturuuu/supabase/next/server';
+import { NextResponse } from 'next/server';
+
+interface Params {
+  params: Promise<{
+    wsId: string;
+  }>;
+}
+
+export async function GET(_: Request, { params }: Params) {
+  const supabase = await createClient();
+  const { wsId: id } = await params;
+
+  const { data, error } = await supabase
+    .from('workspace_flashcards')
+    .select('*')
+    .eq('ws_id', id)
+    .single();
+
+  if (error) {
+    console.log(error);
+    return NextResponse.json(
+      { message: 'Error fetching workspace flashcards' },
+      { status: 500 }
+    );
+  }
+
+  return NextResponse.json(data);
+}
+
+export async function POST(req: Request, { params }: Params) {
+  const supabase = await createClient();
+  const { wsId: id } = await params;
+
+  const { moduleId, ...rest } = await req.json();
+
+  const { data, error } = await supabase
+    .from('workspace_flashcards')
+    .insert({
+      ...rest,
+      ws_id: id,
+    })
+    .select('id')
+    .single();
+
+  if (error) {
+    console.log(error);
+    return NextResponse.json(
+      { message: 'Error creating workspace flashcard' },
+      { status: 500 }
+    );
+  }
+
+  if (moduleId) {
+    await supabase.from('course_module_flashcards').insert({
+      module_id: moduleId,
+      flashcard_id: data.id,
+    });
+  }
path: apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Missing error handling for module linking**

The operation to link the flashcard to a module lacks error handling. If this operation fails, the API would still return a success message, leading to inconsistent state.

Add error handling for the module linking operation:

```diff
if (moduleId) {
-  await supabase.from('course_module_flashcards').insert({
+  const { error: linkError } = await supabase.from('course_module_flashcards').insert({
    module_id: moduleId,
    flashcard_id: data.id,
  });
+  
+  if (linkError) {
+    console.error('Failed to link flashcard to module:', linkError);
+    return NextResponse.json(
+      { message: 'Flashcard created but failed to link to module' },
+      { status: 500 }
+    );
+  }
}
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
  if (moduleId) {
-    await supabase.from('course_module_flashcards').insert({
+    const { error: linkError } = await supabase
+      .from('course_module_flashcards')
+      .insert({
       module_id: moduleId,
       flashcard_id: data.id,
     });
+    
+    if (linkError) {
+      console.error('Failed to link flashcard to module:', linkError);
+      return NextResponse.json(
+        { message: 'Flashcard created but failed to link to module' },
+        { status: 500 }
+      );
+    }
  }
`````

</details>

<!-- suggestion_end -->

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts around lines
54 to 59, the insertion of the flashcard-module link into
'course_module_flashcards' lacks error handling. Modify the code to capture the
result of the insert operation, check for errors, and handle them appropriately
by returning an error response or throwing an exception to prevent returning a
success message when the linking fails.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-10T15:25:48Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,62 @@
+import { createClient } from '@tuturuuu/supabase/next/server';
+import { NextResponse } from 'next/server';
+
+interface Params {
+  params: Promise<{
+    wsId: string;
+  }>;
+}
+
+export async function GET(_: Request, { params }: Params) {
+  const supabase = await createClient();
+  const { wsId: id } = await params;
+
+  const { data, error } = await supabase
+    .from('workspace_flashcards')
+    .select('*')
+    .eq('ws_id', id)
+    .single();
+
+  if (error) {
+    console.log(error);
+    return NextResponse.json(
+      { message: 'Error fetching workspace flashcards' },
+      { status: 500 }
+    );
+  }
+
+  return NextResponse.json(data);
+}
+
+export async function POST(req: Request, { params }: Params) {
+  const supabase = await createClient();
+  const { wsId: id } = await params;
+
+  const { moduleId, ...rest } = await req.json();
+
+  const { data, error } = await supabase
+    .from('workspace_flashcards')
+    .insert({
+      ...rest,
+      ws_id: id,
+    })
+    .select('id')
+    .single();
+
path: apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Consider using transactions for related operations**

The flashcard creation and module linking should be part of a transaction to ensure data consistency.

Implement a transaction to ensure both operations succeed or fail together:

```diff
- const { data, error } = await supabase
-   .from('workspace_flashcards')
-   .insert({
-     ...rest,
-     ws_id: id,
-   })
-   .select('id')
-   .single();

+ // Start a transaction
+ const { data, error } = await supabase.rpc('create_flashcard_with_module', {
+   flashcard_data: { ...rest, ws_id: id },
+   module_id: moduleId || null
+ });
```

This would require creating a stored procedure in Supabase that handles both operations atomically.


> Committable suggestion skipped: line range outside the PR's diff.

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts around lines
37 to 45, the insertion of a flashcard and its module linking are done
separately, risking data inconsistency. Refactor this by creating a Supabase
stored procedure that performs both the flashcard creation and module linking
within a single transaction. Then, call this stored procedure from the code to
ensure both operations succeed or fail atomically, maintaining data integrity.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-10T15:25:48Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,62 @@
+import { createClient } from '@tuturuuu/supabase/next/server';
+import { NextResponse } from 'next/server';
+
+interface Params {
+  params: Promise<{
+    wsId: string;
+  }>;
+}
+
+export async function GET(_: Request, { params }: Params) {
+  const supabase = await createClient();
+  const { wsId: id } = await params;
+
+  const { data, error } = await supabase
+    .from('workspace_flashcards')
+    .select('*')
+    .eq('ws_id', id)
+    .single();
+
+  if (error) {
+    console.log(error);
+    return NextResponse.json(
+      { message: 'Error fetching workspace flashcards' },
+      { status: 500 }
+    );
+  }
+
+  return NextResponse.json(data);
+}
+
+export async function POST(req: Request, { params }: Params) {
+  const supabase = await createClient();
+  const { wsId: id } = await params;
+
+  const { moduleId, ...rest } = await req.json();
path: apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Consider validating input data**

There's no validation for the request payload beyond extracting the moduleId.

Add validation to ensure the required fields are present and have the correct format:

```diff
- const { moduleId, ...rest } = await req.json();
+ const body = await req.json();
+ const { moduleId, question, answer, ...rest } = body;
+
+ // Validate required fields
+ if (!question || !answer) {
+   return NextResponse.json(
+     { message: 'Question and answer are required' },
+     { status: 400 }
+   );
+ }
```

This helps prevent invalid data from being stored in the database.


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
  const body = await req.json();
  const { moduleId, question, answer, ...rest } = body;

  // Validate required fields
  if (!question || !answer) {
    return NextResponse.json(
      { message: 'Question and answer are required' },
      { status: 400 }
    );
  }
`````

</details>

<!-- suggestion_end -->

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts at line 35,
the request payload is destructured without any validation. Add validation logic
after extracting the JSON to check that required fields like moduleId and others
in rest are present and conform to expected types or formats. Use conditional
checks or a validation library to enforce this before proceeding, and handle
invalid input by returning an appropriate error response to prevent storing
invalid data.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-10T15:25:48Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,62 @@
+import { createClient } from '@tuturuuu/supabase/next/server';
+import { NextResponse } from 'next/server';
+
+interface Params {
+  params: Promise<{
+    wsId: string;
+  }>;
+}
+
+export async function GET(_: Request, { params }: Params) {
+  const supabase = await createClient();
+  const { wsId: id } = await params;
+
+  const { data, error } = await supabase
+    .from('workspace_flashcards')
+    .select('*')
+    .eq('ws_id', id)
+    .single();
+
+  if (error) {
+    console.log(error);
+    return NextResponse.json(
+      { message: 'Error fetching workspace flashcards' },
+      { status: 500 }
+    );
+  }
+
+  return NextResponse.json(data);
+}
path: apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**GET handler returns single flashcard instead of multiple**

The GET handler uses `.single()` on line 18, which expects and returns only one flashcard from the workspace. This seems inconsistent with the expected behavior where a workspace would typically have multiple flashcards.

Update the query to return multiple records instead of a single one:

```diff
const { data, error } = await supabase
  .from('workspace_flashcards')
  .select('*')
  .eq('ws_id', id)
- .single();
```

This allows returning all flashcards for the workspace. You may also want to consider adding pagination parameters if there could be many records.


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
export async function GET(_: Request, { params }: Params) {
  const supabase = await createClient();
  const { wsId: id } = await params;

  const { data, error } = await supabase
    .from('workspace_flashcards')
    .select('*')
    .eq('ws_id', id);

  if (error) {
    console.log(error);
    return NextResponse.json(
      { message: 'Error fetching workspace flashcards' },
      { status: 500 }
    );
  }

  return NextResponse.json(data);
}
`````

</details>

<!-- suggestion_end -->

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts between
lines 10 and 29, the GET handler uses .single() on the Supabase query which
restricts the result to one flashcard. Remove the .single() method to allow
fetching multiple flashcards for the workspace. Optionally, consider
implementing pagination to handle large result sets efficiently.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-10T15:25:48Z
author_association: CONTRIBUTOR
diff_hunk: @@ -5,13 +5,11 @@
 
   return embedId ? (
     <iframe
-      width="853"
-      height="480"
       src={`https://www.youtube.com/embed/${embedId}`}
       allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
       allowFullScreen
       title="Embedded youtube"
-      className="aspect-video h-48 w-full rounded-lg md:h-64 lg:h-96"
+      className="h-full w-full rounded-lg"
path: apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx
user: login: coderabbitai[bot]
body: _💡 Verification agent_

<details>
<summary>🧩 Analysis chain</summary>

**Improvement to responsive design - looks good!**

Changing to fluid width and height with `h-full w-full` improves the component's responsiveness, allowing it to properly adapt to its container size rather than using fixed dimensions. The `rounded-lg` class provides a consistent visual style with rounded corners.

This change correctly implements the dynamic sizing for module video previews mentioned in the PR objectives. According to the AI summary, this component is now wrapped in an `aspect-video` container in the parent component, ensuring proper aspect ratio is maintained.



The static analysis indicates this line isn't covered by tests. While this is a low-risk UI change, consider adding a simple unit test to verify the component renders properly with different embed IDs:

---

🏁 Script executed:

```shell
#!/bin/bash
# Check if there are any existing tests for this component
fd -e test.tsx -e spec.tsx "YoutubeEmbed" apps/upskii/src
```

Length of output: 57

---

🏁 Script executed:

```shell
#!/bin/bash
# Locate the embed.tsx file and display its first 50 lines to identify the component name
FILE=$(fd embed.tsx -t f apps/upskii/src)
echo "Found embed.tsx at: $FILE"
head -n 50 "$FILE"
```

Length of output: 1079

---



</details>

**Fluid responsive design improvement approved**

The switch to `h-full w-full` correctly makes the YouTube iframe adapt to its container, and `rounded-lg` maintains the intended styling. This aligns with the PR goal of dynamic sizing, especially since the parent wrapper applies `aspect-video` to preserve the aspect ratio.

However, there are currently no unit tests for the `YoutubeEmbed` component. To ensure ongoing stability and catch regressions, please add at least one simple test (e.g., with React Testing Library) covering:

- Rendering the iframe when a valid `embedId` is provided  
- Displaying the “invalid YouTube link” message when `embedId` is `undefined` or empty

Relevant file:  
• apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 GitHub Check: codecov/patch</summary>

[warning] 12-12: apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx#L12
Added line #L12 was not covered by tests

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx
at line 12, the YouTube iframe uses responsive classes but lacks unit test
coverage. Add a simple test using React Testing Library that verifies the
component renders the iframe correctly when given a valid embedId and shows the
"invalid YouTube link" message when embedId is undefined or empty. This will
ensure the component's rendering behavior is properly tested.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-10T15:48:33Z
author_association: CONTRIBUTOR
diff_hunk: @@ -101,7 +101,7 @@
         title={t('ws-flashcards.edit')}
         editDescription={t('ws-flashcards.edit_description')}
         setOpen={setShowEditDialog}
-        form={<WorkspaceCourseForm wsId={data.ws_id} data={data} />}
+        form={<WorkspaceCourseForm wsId={data.ws_id} data={{ ...data, description: data.description ?? '' }} />}
path: apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/row-actions.tsx
user: login: coderabbitai[bot]
body: _💡 Verification agent_

<details>
<summary>🧩 Analysis chain</summary>

**Properly handling nullable description field.**

The change ensures the WorkspaceCourseForm always receives a defined string value for the description field, preventing potential rendering issues or form validation errors when the description is null or undefined.


This line is flagged as not covered by tests. Consider adding tests for scenarios where course description is null or undefined to ensure this fallback behavior works as expected.

---

🏁 Script executed:

```shell
#!/bin/bash
# Check if there are other similar form components that might need the same null-safety pattern
fd 'WorkspaceCourseForm' --type file | xargs rg -A 3 -B 3 'WorkspaceCourseForm'

# Look for similar null coalescing patterns in other forms
fd '\.tsx$' --type file | xargs rg 'data={(.*?) \?\? (.*)}'
```

Length of output: 3150

---



</details>

**Add tests for nullable description fallback and align usage in web app**

- Ensure the `WorkspaceCourseForm` in apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/row-actions.tsx is covered by tests for cases when `data.description` is `null` or `undefined`, verifying it falls back to an empty string as intended.  
- We discovered a similar usage in apps/web/src/app/[locale]/(dashboard)/[wsId]/education/courses/row-actions.tsx where `WorkspaceCourseForm` is passed `data={data}` without null‐safety. Please review and, if necessary, apply the same `description ?? ''` pattern there to maintain consistency and prevent runtime issues.

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 GitHub Check: codecov/patch</summary>

[warning] 104-104: apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/row-actions.tsx#L104
Added line #L104 was not covered by tests

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/row-actions.tsx at
line 104, add tests to cover the case where data.description is null or
undefined to verify the fallback to an empty string works correctly in
WorkspaceCourseForm. Additionally, review
apps/web/src/app/[locale]/(dashboard)/[wsId]/education/courses/row-actions.tsx
for usage of WorkspaceCourseForm and apply the same null coalescing pattern
(description ?? '') to ensure consistent null-safety across the codebase.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-10T16:11:21Z
author_association: CONTRIBUTOR

PR comments:
user: login: graphite-app[bot]
created_at: 2025-05-10T15:21:13Z
body: ## How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:
- <kbd>merge-queue</kbd> - adds this PR to the back of the merge queue
- <kbd>hotfix</kbd> - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using [this link](https://app.graphite.dev/invite/github/tutur3u?ref=merge-queue-instructions-comment&prId=6202214000).

<h2></h2>
<sub>

An organization admin has enabled the [Graphite Merge Queue](https://graphite.dev/docs/graphite-merge-queue) in this repository.

</sub>

<sub>

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

</sub>
author_association: NONE
user: login: coderabbitai[bot]
created_at: 2025-05-10T15:21:14Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

## Walkthrough

The changes introduce new API routes for managing workspace flashcards, update type definitions to include a course description, and enhance UI components for course details, YouTube embeds, and module deletion confirmation. The updates improve data handling and user interaction without altering public interfaces or existing control flow.

## Changes

| File(s)                                                                                                   | Change Summary                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|-----------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/route.ts`,<br>`apps/upskii/src/app/api/v1/workspaces/[wsId]/flashcards/[flashcardId]/route.ts` | Added new API route handlers for workspace flashcards: <br>- `GET` and `POST` for creating and retrieving flashcards, with optional module linking.<br>- `PUT` and `DELETE` for updating and deleting specific flashcards, with error handling and Supabase integration.                                                                                                       |
| `apps/upskii/src/app/api/ai/objects/flashcards/route.ts`                                                  | Introduced a new API route re-exporting a POST handler for AI-generated flashcards, with configuration for runtime, region, and duration.                                                                                                                                                                                                                                                                                                                |
| `packages/types/src/supabase.ts`,<br>`packages/types/src/primitives/UserGroup.ts`                         | Added optional `description` field/property to the `workspace_courses` table type definitions and to the `UserGroup` interface.                                                                                                                                                                                                                                                                                                                        |
| `apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/layout.tsx`                           | Updated `FeatureSummary` component to accept and render a `description` prop, displaying the course description or a fallback string.                                                                                                                                                                                                                                                                            |
| `apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/row-actions.tsx`                      | Added a confirmation dialog for module deletion, introducing a state variable to control dialog visibility and requiring user confirmation before deletion. Also updated the `WorkspaceCourseForm` props to ensure `description` is never null or undefined.                                                                                                                                                                                        |
| `apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/embed.tsx`,<br>`apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/[courseId]/modules/[moduleId]/youtube-links/page.tsx` | Modified YouTube embed component to remove fixed width/height attributes and simplified iframe styling for responsiveness; wrapped embeds in a responsive aspect-ratio container for layout consistency.                                                                                                                                                                                                                                     |
| `apps/upskii/src/app/[locale]/(dashboard)/[wsId]/courses/mock/mock-courses.tsx`                            | Deleted mock data file that provided sample workspace courses for testing or development.                                                                                                                                                                                                                                                                                                                                                                         |
| `turbo.json`                                                                                              | Reformatted arrays for readability and added environment variables related to Google Vertex authentication.                                                                                                                                                                                                                                                                                                                                                     |
| `apps/db/supabase/migrations/20250511120347_new_migration.sql`                                           | Added a new database migration to add a `description` column with default empty string to the `workspace_courses` table.                                                                                                                                                                                                                                                                                                                                         |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant Client
    participant API_Route
    participant Supabase

    Client->>API_Route: POST /api/v1/workspaces/{wsId}/flashcards (with data)
    API_Route->>Supabase: Insert flashcard into workspace_flashcards
    alt moduleId provided
        API_Route->>Supabase: Insert link into course_module_flashcards
    end
    Supabase-->>API_Route: Success/Failure
    API_Route-->>Client: JSON response
```

```mermaid
sequenceDiagram
    participant User
    participant UI_Component

    User->>UI_Component: Click "Delete" on module
    UI_Component->>UI_Component: Open confirmation dialog
    User->>UI_Component: Confirm deletion
    UI_Component->>API: Call deleteWorkspaceCourseModule
    API-->>UI_Component: Deletion result
```

## Possibly related PRs

- tutur3u/platform#2636: Introduces foundational course management features including UI for listing, creating, editing, and deleting courses with confirmation dialogs and mock data; related due to overlapping course description handling and UI components.

## Suggested labels

`upskii`

## Poem

> In the garden of code where flashcards grow,  
> New routes now bloom, descriptions in tow.  
> A dialog appears—“Are you sure?”—before things go,  
> YouTube embeds stretch wide, in a responsive show.  
> With types refined and logic neat,  
> This bunny hops to a tidy beat! 🐇✨

<!-- walkthrough_end -->


---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 38aee522ef97cba3987ab44ac98c6245c7a3be1f and 1863381e333f8d4776740a3780278a44cdf77908.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `apps/db/supabase/migrations/20250511120347_new_migration.sql` (1 hunks)

</details>

<details>
<summary>✅ Files skipped from review due to trivial changes (1)</summary>

* apps/db/supabase/migrations/20250511120347_new_migration.sql

</details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQ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r42AM+WfYPjX0wGAD4BOApAWXzT4ECq+xA/PhgN87243kmkWgAIEMiek7ypcZ2MXQQjvxBgWZa+CgSEGDB34IEXoN0AFIbRda3ApdBoEQABAvACXBFmm0HipdMu9xBDPUCIAT8TmMYT4pnh+JA9RQD+KcJNWebrMjalDHktEG7rlA7gKwMMFJAPDegxyPmRcI4CwAbt6A0QEHhgHKDCMGGNADGuRzcGjoPBjDJjMATQDeBQgyPezDd3URYFSwurI1tPyCZz8+Y2hKgNLkqjN8aqsqKhnIy0H45D+6TCnrTlXSn8CkSnXdEoSv6C8qca8CxNdC+wvA6OFUJjH034LuDPgbpL6jILVBSZz+ynTDnRG1zX9chWXe2h5BMpKQVIGEShNhGiG4REWWhYiIUBEhoAxIGbeQNJHogqA1A8kFiHMLYhEQJcf7GfAKUG63haAApeXPrEUjKRThDAL4IMEGBoB+gXwa+CQG6AgQUC/QECNfAEC9B34/YfsCBDmAkAlEKBboP2G6AoE0A18foL0FoDdB+gKBR4QYFOH9AlEgwECAwCEEQxfhgwSEf0HRFfABA78JRH8NREoElEFI6+EomAJKICRcwOYKiMxGnDaAAIpkb0CZGiDegXwKkUogGDwjegKga+CiLQBoAYRIEboO/HbBfBugJIwYP0E5HoRIAIEfoAIFxEkB34KBAQLfFoBzBVR78a+N0GvgMAARaAfUV8BxFVhqR+I3oO8MFHdB1REAdANfDQBKIBAcwGEQIFoCzBAxcwL4SIIYCiD34/Qd+N/mdG/DIxOIwYOKJ1HuioAWotAGuGvhvDmR3QBgO2BAhKJ+g3QFQL0HFEMACxDAE0b0EtFFiQIUwFArWFYgaj/hcwECFqJQIkBWxIEO0bQHEHzA+g78NAHKKjGzB+gaAEsQwFoBKjugSiSMZiKxEaihI6gC4b+2uHitbhmER4UAA== -->

<!-- internal state end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=tutur3u/platform&utm_content=2768):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: CONTRIBUTOR
user: login: codecov[bot]
created_at: 2025-05-10T15:25:57Z
body: ## [Codecov](https://app.codecov.io/gh/tutur3u/platform/pull/2768?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u) Report
Attention: Patch coverage is `0%` with `153 lines` in your changes missing coverage. Please review.
> Project coverage is 0.76%. Comparing base [(`6113fb7`)](https://app.codecov.io/gh/tutur3u/platform/commit/6113fb799c1831d3387db4a54c56354cd959bc86?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u) to head [(`1863381`)](https://app.codecov.io/gh/tutur3u/platform/commit/1863381e333f8d4776740a3780278a44cdf77908?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u).
> Report is 14 commits behind head on main.

| [Files with missing lines](https://app.codecov.io/gh/tutur3u/platform/pull/2768?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u) | Patch % | Lines |
|---|---|---|
| [...c/app/api/v1/workspaces/[wsId]/flashcards/route.ts](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&filepath=apps%2Fupskii%2Fsrc%2Fapp%2Fapi%2Fv1%2Fworkspaces%2F%5BwsId%5D%2Fflashcards%2Froute.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u#diff-YXBwcy91cHNraWkvc3JjL2FwcC9hcGkvdjEvd29ya3NwYWNlcy9bd3NJZF0vZmxhc2hjYXJkcy9yb3V0ZS50cw==) | 0.00% | [61 Missing and 1 partial :warning: ](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u) |
| [...orkspaces/[wsId]/flashcards/[flashcardId]/route.ts](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&filepath=apps%2Fupskii%2Fsrc%2Fapp%2Fapi%2Fv1%2Fworkspaces%2F%5BwsId%5D%2Fflashcards%2F%5BflashcardId%5D%2Froute.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u#diff-YXBwcy91cHNraWkvc3JjL2FwcC9hcGkvdjEvd29ya3NwYWNlcy9bd3NJZF0vZmxhc2hjYXJkcy9bZmxhc2hjYXJkSWRdL3JvdXRlLnRz) | 0.00% | [50 Missing and 1 partial :warning: ](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u) |
| [...shboard)/[wsId]/courses/[courseId]/row-actions.tsx](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&filepath=apps%2Fupskii%2Fsrc%2Fapp%2F%5Blocale%5D%2F%28dashboard%29%2F%5BwsId%5D%2Fcourses%2F%5BcourseId%5D%2Frow-actions.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u#diff-YXBwcy91cHNraWkvc3JjL2FwcC9bbG9jYWxlXS8oZGFzaGJvYXJkKS9bd3NJZF0vY291cnNlcy9bY291cnNlSWRdL3Jvdy1hY3Rpb25zLnRzeA==) | 0.00% | [23 Missing :warning: ](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u) |
| [...locale]/(dashboard)/[wsId]/courses/row-actions.tsx](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&filepath=apps%2Fupskii%2Fsrc%2Fapp%2F%5Blocale%5D%2F%28dashboard%29%2F%5BwsId%5D%2Fcourses%2Frow-actions.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u#diff-YXBwcy91cHNraWkvc3JjL2FwcC9bbG9jYWxlXS8oZGFzaGJvYXJkKS9bd3NJZF0vY291cnNlcy9yb3ctYWN0aW9ucy50c3g=) | 0.00% | [6 Missing :warning: ](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u) |
| [.../upskii/src/app/api/ai/objects/flashcards/route.ts](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&filepath=apps%2Fupskii%2Fsrc%2Fapp%2Fapi%2Fai%2Fobjects%2Fflashcards%2Froute.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u#diff-YXBwcy91cHNraWkvc3JjL2FwcC9hcGkvYWkvb2JqZWN0cy9mbGFzaGNhcmRzL3JvdXRlLnRz) | 0.00% | [5 Missing and 1 partial :warning: ](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u) |
| [...ourseId]/modules/[moduleId]/youtube-links/page.tsx](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&filepath=apps%2Fupskii%2Fsrc%2Fapp%2F%5Blocale%5D%2F%28dashboard%29%2F%5BwsId%5D%2Fcourses%2F%5BcourseId%5D%2Fmodules%2F%5BmoduleId%5D%2Fyoutube-links%2Fpage.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u#diff-YXBwcy91cHNraWkvc3JjL2FwcC9bbG9jYWxlXS8oZGFzaGJvYXJkKS9bd3NJZF0vY291cnNlcy9bY291cnNlSWRdL21vZHVsZXMvW21vZHVsZUlkXS95b3V0dWJlLWxpbmtzL3BhZ2UudHN4) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u) |
| [...]/(dashboard)/[wsId]/courses/[courseId]/layout.tsx](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&filepath=apps%2Fupskii%2Fsrc%2Fapp%2F%5Blocale%5D%2F%28dashboard%29%2F%5BwsId%5D%2Fcourses%2F%5BcourseId%5D%2Flayout.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u#diff-YXBwcy91cHNraWkvc3JjL2FwcC9bbG9jYWxlXS8oZGFzaGJvYXJkKS9bd3NJZF0vY291cnNlcy9bY291cnNlSWRdL2xheW91dC50c3g=) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u) |
| [...urseId]/modules/[moduleId]/youtube-links/embed.tsx](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&filepath=apps%2Fupskii%2Fsrc%2Fapp%2F%5Blocale%5D%2F%28dashboard%29%2F%5BwsId%5D%2Fcourses%2F%5BcourseId%5D%2Fmodules%2F%5BmoduleId%5D%2Fyoutube-links%2Fembed.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u#diff-YXBwcy91cHNraWkvc3JjL2FwcC9bbG9jYWxlXS8oZGFzaGJvYXJkKS9bd3NJZF0vY291cnNlcy9bY291cnNlSWRdL21vZHVsZXMvW21vZHVsZUlkXS95b3V0dWJlLWxpbmtzL2VtYmVkLnRzeA==) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/tutur3u/platform/pull/2768?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u) |

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##             main    #2768      +/-   ##
==========================================
- Coverage    0.76%    0.76%   -0.01%     
==========================================
  Files        2367     2369       +2     
  Lines      276399   276515     +116     
  Branches     2807     2809       +2     
==========================================
  Hits         2119     2119              
- Misses     272240   272354     +114     
- Partials     2040     2042       +2     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/tutur3u/platform/pull/2768?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u).

<details><summary> :rocket: New features to boost your workflow: </summary>

- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
author_association: NONE