()
| 37 | } |
| 38 | |
| 39 | export const GetAppxAuthToken = async (): Promise<GetAppxAuthTokenResponse> => { |
| 40 | const session = await getServerSession(authOptions); |
| 41 | if (!session || !session.user) throw new Error("User is not logged in"); |
| 42 | |
| 43 | const user = await db.user.findFirst({ |
| 44 | where: { |
| 45 | email: session.user.email, |
| 46 | }, |
| 47 | select: { |
| 48 | name: true, |
| 49 | email: true, |
| 50 | appxAuthToken: true, |
| 51 | appxUserId: true |
| 52 | } |
| 53 | }); |
| 54 | |
| 55 | if (!user || !user.appxAuthToken) throw new Error("User not found"); |
| 56 | return user; |
| 57 | }; |
| 58 | |
| 59 | export const GetAppxVideoPlayerUrl = async (courseId: string, videoId: string): Promise<string> => { |
| 60 | const { name, email, appxAuthToken, appxUserId } = await GetAppxAuthToken(); |
no outgoing calls
no test coverage detected