Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple changes for assigning null values #3752

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions packages/hoppscotch-backend/src/admin/admin.service.ts
Expand Up @@ -80,7 +80,7 @@ export class AdminService {
await this.mailerService.sendUserInvitationEmail(inviteeEmail, {
template: 'user-invitation',
variables: {
inviteeEmail: inviteeEmail,
inviteeEmail, //also change hre
magicLink: `${this.configService.get('VITE_BASE_URL')}`,
},
});
Expand All @@ -89,19 +89,20 @@ export class AdminService {
}

// Add invitee email to the list of invited users by admin

const dbInvitedUser = await this.prisma.invitedUsers.create({
data: {
adminUid: adminUID,
adminEmail: adminEmail,
inviteeEmail: inviteeEmail,
adminUid,
adminEmail,
inviteeEmail
},
});

const {invitedOn} = dbInvitedUser
const invitedUser = <InvitedUser>{
adminEmail: dbInvitedUser.adminEmail,
adminUid: dbInvitedUser.adminUid,
inviteeEmail: dbInvitedUser.inviteeEmail,
invitedOn: dbInvitedUser.invitedOn,
invitedOn
};

// Publish invited user subscription
Expand Down
16 changes: 8 additions & 8 deletions packages/hoppscotch-backend/src/user/user.service.ts
Expand Up @@ -40,13 +40,13 @@ export class UserService {
const dbCurrentGQLSession = dbUser.currentGQLSession;

return {
...dbUser,
...dbUser,
currentRESTSession: dbCurrentRESTSession
? JSON.stringify(dbCurrentRESTSession)
: null,
currentGQLSession: dbCurrentGQLSession
? JSON.stringify(dbCurrentGQLSession)
: null,
: null
};
}

Expand Down Expand Up @@ -147,8 +147,8 @@ export class UserService {
refreshTokenSSO: string,
profile,
) {
const userDisplayName = !profile.displayName ? null : profile.displayName;
const userPhotoURL = !profile.photos ? null : profile.photos[0].value;
const userDisplayName = profile?.displayName ?? null;
const userPhotoURL = profile?.photos?.[0]?.value ?? null;

const createdUser = await this.prisma.user.create({
data: {
Expand Down Expand Up @@ -188,8 +188,8 @@ export class UserService {
data: {
provider: profile.provider,
providerAccountId: profile.id,
providerRefreshToken: refreshToken ? refreshToken : null,
providerAccessToken: accessToken ? accessToken : null,
providerRefreshToken: refreshToken ?? null,
providerAccessToken: accessToken ?? null,
user: {
connect: {
uid: user.uid,
Expand All @@ -215,8 +215,8 @@ export class UserService {
uid: user.uid,
},
data: {
displayName: !profile.displayName ? null : profile.displayName,
photoURL: !profile.photos ? null : profile.photos[0].value,
displayName: profile?.displayName ?? null,
photoURL: profile?.photos[0]?.value ?? null,
},
});
return E.right(updatedUser);
Expand Down