-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated the queries for mobile routes
- Loading branch information
1 parent
0c553e9
commit 43e1f1c
Showing
5 changed files
with
36 additions
and
78 deletions.
There are no files selected for viewing
27 changes: 4 additions & 23 deletions
27
src/app/api/mobile/courses/[courseId]/[collectionId]/[contentId]/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 13 additions & 36 deletions
49
src/app/api/mobile/courses/[courseId]/[collectionId]/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import db from '@/db'; | ||
|
||
export async function checkUserCourse(userId: string, courseId: string) { | ||
const userCourse = await db.course.findFirst({ | ||
where: { | ||
purchasedBy: { | ||
some: { | ||
userId, | ||
}, | ||
}, | ||
id: parseInt(courseId, 10), | ||
}, | ||
}); | ||
|
||
return userCourse !== null; | ||
} |