diff --git a/src/app/actions/get-categories-and-lessons.tsx b/src/app/actions/get-categories-and-lessons.tsx new file mode 100644 index 0000000..ca13e64 --- /dev/null +++ b/src/app/actions/get-categories-and-lessons.tsx @@ -0,0 +1,36 @@ +import prisma from "@/lib/prisma"; + +export default async function getCategoriesWithLessons() { + const categories = await prisma.categories.findMany({ + where: { + Lessons: { + some: { + draft: false, + }, + }, + }, + orderBy: { + sort_number: "asc", + }, + include: { + Lessons: { + where: { + draft: false, + sort_number: { + gt: 0, + }, + }, + orderBy: { + sort_number: "asc", + }, + select: { + id: true, + title: true, + slug: true + } + }, + }, + }); + + return categories; +} \ No newline at end of file diff --git a/src/app/actions/get-lessons-for-shortcut.tsx b/src/app/actions/get-lessons-for-shortcut.tsx new file mode 100644 index 0000000..f7c7680 --- /dev/null +++ b/src/app/actions/get-lessons-for-shortcut.tsx @@ -0,0 +1,12 @@ +import prisma from "@/lib/prisma"; + +export async function getLessonsForShortcut() { + const res = await prisma.lessons.findMany({ + select: { + id: true, + title: true, + slug: true, + } + }) + return res; +} \ No newline at end of file diff --git a/src/components/dashboard/feedback-menu.tsx b/src/components/dashboard/feedback-menu.tsx index 60ec888..87b8771 100644 --- a/src/components/dashboard/feedback-menu.tsx +++ b/src/components/dashboard/feedback-menu.tsx @@ -59,7 +59,7 @@ const FeedbackMenu = () => {