Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #24 from Firgrep/dev-firgrep
Browse files Browse the repository at this point in the history
db schema update, added CourseDetails model and some other fields
  • Loading branch information
Firgrep authored Sep 18, 2023
2 parents 3cefd3d + f0c591d commit b509add
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 17 deletions.
49 changes: 32 additions & 17 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ model Session {
}

model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
role Role @default(BASIC)
accounts Account[]
sessions Session[]
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
role Role @default(BASIC)
accounts Account[]
sessions Session[]
stripeCustomerId String? @unique
stripePurchasedProducts String[]
lessonsCompleted UserLessonProgress[]
}

Expand All @@ -66,15 +70,26 @@ model VerificationToken {

// Course, Lessons and Content related data
model Course {
id String @id @default(cuid())
name String
description String
slug String @unique
imageUrl String?
parts Part[]
lessons Lesson[]
author String?
published Boolean @default(false)
id String @id @default(cuid())
name String
description String
slug String @unique
stripeProductId String? @unique
imageUrl String?
parts Part[]
lessons Lesson[]
details CourseDetails?
author String?
published Boolean @default(false)
}

model CourseDetails {
id String @id @default(cuid())
course Course @relation(fields: [courseId], references: [id])
courseId String @unique
content Bytes
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model Part {
Expand Down
3 changes: 3 additions & 0 deletions src/components/LoadingBars.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Purely presentational UI component that shows DaisyUI loading bars centered in its scope.
*/
const LoadingBars = () => {
return (
<div className="w-full h-full flex flex-col justify-center items-center">
Expand Down
30 changes: 30 additions & 0 deletions src/server/controllers/mdxController.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { AuthenticationError, requireAdminAuth } from "../auth";

type MdxGetCompiledSourceProps = {
courseSlug: string;
partSlug?: string;
lessonSlug?: string;
access: "PUBLIC" | "USER" | "ADMIN";
}
/**
* WIP
*/
const mdxGetCompiledSource = async ({
courseSlug, partSlug, lessonSlug, access
}: MdxGetCompiledSourceProps) => {
try {
await requireAdminAuth();





return;
} catch (error) {

if (error instanceof AuthenticationError) {
throw error; // Rethrow custom error as-is
}
throw new Error("An error occurred while fetching courses.");
}
}

0 comments on commit b509add

Please sign in to comment.