MCPcopy Create free account
hub / github.com/code100x/cms / checkUserCourseAccess

Function checkUserCourseAccess

src/app/api/mobile/courses/[courseId]/route.ts:4–17  ·  view source on GitHub ↗
(userId: string, courseId: string)

Source from the content-addressed store, hash-verified

2import { NextResponse, NextRequest } from 'next/server';
3
4async function checkUserCourseAccess(userId: string, courseId: string) {
5 const userCourse = await db.course.findFirst({
6 where: {
7 purchasedBy: {
8 some: {
9 userId,
10 },
11 },
12 id: parseInt(courseId, 10),
13 },
14 });
15
16 return userCourse !== null;
17}
18
19export async function GET(
20 request: NextRequest,

Callers 1

GETFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected