Skip to content

Commit

Permalink
Fix build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
paustint committed Feb 8, 2024
1 parent c99cec1 commit b098867
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions apps/api/src/app/controllers/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,17 @@ export async function emailSupport(req: express.Request, res: express.Response)
export async function getUserProfile(req: express.Request, res: express.Response) {
const auth0User = req.user as UserProfileServer;
const user = await userDbService.findByUserId(auth0User.id);
if (!user) {
throw new UserFacingError('User not found');
}
const userProfileUi: UserProfileUi = {
...(auth0User._json as any),
id: user.id,
userId: user.userId,
createdAt: user.createdAt.toISOString(),
updatedAt: user.updatedAt.toISOString(),
preferences: {
skipFrontdoorLogin: user.preferences.skipFrontdoorLogin,
skipFrontdoorLogin: user.preferences?.skipFrontdoorLogin,
},
};
sendJson(res, userProfileUi);
Expand All @@ -77,17 +80,20 @@ export async function getUserProfile(req: express.Request, res: express.Response
async function getFullUserProfileFn(sessionUser: UserProfileServer, auth0User?: UserProfileAuth0Ui) {
auth0User = auth0User || (await auth0Service.getUser(sessionUser));
const jetstreamUser = await userDbService.findByUserId(sessionUser.id);
if (!jetstreamUser) {
throw new UserFacingError('User not found');
}
const response: UserProfileUiWithIdentities = {
id: jetstreamUser.id,
userId: sessionUser.id,
name: jetstreamUser.name,
name: jetstreamUser.name || '',
email: jetstreamUser.email,
emailVerified: auth0User.email_verified,
username: auth0User.username,
username: auth0User.username || '',
nickname: auth0User.nickname,
picture: auth0User.picture,
preferences: {
skipFrontdoorLogin: jetstreamUser.preferences.skipFrontdoorLogin,
skipFrontdoorLogin: jetstreamUser.preferences?.skipFrontdoorLogin ?? false,
},
identities: auth0User.identities,
createdAt: jetstreamUser.createdAt.toISOString(),
Expand Down

0 comments on commit b098867

Please sign in to comment.