diff --git a/package.json b/package.json index 02ae477d3..118646510 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "discord-oauth2": "^2.11.0", "discord.js": "^14.14.1", "fuse.js": "^7.0.0", + "embla-carousel-react": "^8.0.0", "jose": "^5.2.2", "jsonwebtoken": "^9.0.2", "lucide-react": "^0.321.0", diff --git a/prisma/migrations/20240324133414_modify_video_progress/migration.sql b/prisma/migrations/20240324133414_modify_video_progress/migration.sql new file mode 100644 index 000000000..7b93a9771 --- /dev/null +++ b/prisma/migrations/20240324133414_modify_video_progress/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "VideoProgress" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index b0215f596..a4bc79d74 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -131,7 +131,7 @@ model User { bookmarks Bookmark[] password String? appxUserId String? - appxUsername String? + appxUsername String? } model DiscordConnect { @@ -150,13 +150,14 @@ model DiscordConnectBulk { } model VideoProgress { - id Int @id @default(autoincrement()) + id Int @id @default(autoincrement()) userId String contentId Int currentTimestamp Int - user User @relation(fields: [userId], references: [id], onDelete: Cascade) - content Content @relation(fields: [contentId], references: [id], onDelete: Cascade) - markAsCompleted Boolean @default(false) + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + content Content @relation(fields: [contentId], references: [id], onDelete: Cascade) + markAsCompleted Boolean @default(false) + updatedAt DateTime @default(now()) @updatedAt @@unique([contentId, userId]) } diff --git a/src/app/api/course/videoProgress/route.ts b/src/app/api/course/videoProgress/route.ts index aa2b643b9..15f3ffb14 100644 --- a/src/app/api/course/videoProgress/route.ts +++ b/src/app/api/course/videoProgress/route.ts @@ -2,6 +2,7 @@ import { NextRequest, NextResponse } from 'next/server'; import db from '@/db'; import { getServerSession } from 'next-auth'; import { authOptions } from '@/lib/auth'; +import { revalidatePath } from 'next/cache'; export async function GET(req: NextRequest) { const url = new URL(req.url); @@ -47,5 +48,6 @@ export async function POST(req: NextRequest) { currentTimestamp, }, }); + revalidatePath('/history'); return NextResponse.json(updatedRecord); } diff --git a/src/app/history/loading.tsx b/src/app/history/loading.tsx new file mode 100644 index 000000000..467c3a68b --- /dev/null +++ b/src/app/history/loading.tsx @@ -0,0 +1,11 @@ +import { CourseSkeleton } from '@/components/CourseCard'; + +export default function Loading() { + return ( +