(
req: UpdateReqType<typeof schemas.getSessionUser>,
res: FastifyReply
)
| 719 | done |
| 720 | ) => { |
| 721 | const getSessionUserHandler = async ( |
| 722 | req: UpdateReqType<typeof schemas.getSessionUser>, |
| 723 | res: FastifyReply |
| 724 | ) => { |
| 725 | const logger = fastify.log.child({ req, res }); |
| 726 | // This is one of the most requested routes. To avoid spamming the logs |
| 727 | // with this route, we'll log requests at the debug level. |
| 728 | logger.debug({ userId: req.user?.id }); |
| 729 | |
| 730 | // Handle unauthenticated users - this is not an error, it's how the client |
| 731 | // determines if they are signed in or not |
| 732 | if (!req.user?.id) { |
| 733 | logger.debug('Unauthenticated user requested session'); |
| 734 | return { user: {}, result: '' }; |
| 735 | } |
| 736 | |
| 737 | try { |
| 738 | const userTokenP = fastify.prisma.userToken.findFirst({ |
| 739 | where: { userId: req.user.id } |
| 740 | }); |
| 741 | |
| 742 | const userP = fastify.prisma.user.findUnique({ |
| 743 | where: { id: req.user.id }, |
| 744 | select: { |
| 745 | about: true, |
| 746 | acceptedPrivacyTerms: true, |
| 747 | completedChallenges: true, |
| 748 | completedDailyCodingChallenges: true, |
| 749 | completedExams: true, |
| 750 | currentChallengeId: true, |
| 751 | quizAttempts: true, |
| 752 | email: true, |
| 753 | emailVerified: true, |
| 754 | githubProfile: true, |
| 755 | id: true, |
| 756 | is2018DataVisCert: true, |
| 757 | is2018FullStackCert: true, |
| 758 | isA2EnglishCert: true, |
| 759 | isApisMicroservicesCert: true, |
| 760 | isBackEndCert: true, |
| 761 | isCheater: true, |
| 762 | isCollegeAlgebraPyCertV8: true, |
| 763 | isDataAnalysisPyCertV7: true, |
| 764 | isDataVisCert: true, |
| 765 | isDonating: true, |
| 766 | isFoundationalCSharpCertV8: true, |
| 767 | isFrontEndCert: true, |
| 768 | isFrontEndLibsCert: true, |
| 769 | isFullStackCert: true, |
| 770 | isClassroomAccount: true, |
| 771 | isHonest: true, |
| 772 | isInfosecCertV7: true, |
| 773 | isInfosecQaCert: true, |
| 774 | isJavascriptCertV9: true, |
| 775 | isJsAlgoDataStructCert: true, |
| 776 | isJsAlgoDataStructCertV8: true, |
| 777 | isMachineLearningPyCertV7: true, |
| 778 | isPythonCertV9: true, |
nothing calls this directly
no test coverage detected