making changes to user model to know what's optional and what's not to protect against google

This commit is contained in:
talksik
2022-05-05 04:45:08 -05:00
parent fbcd97ca89
commit 34e5a19276
3 changed files with 13 additions and 11 deletions
+4 -5
View File
@@ -93,18 +93,17 @@ async function login(req: Request, res: Response) {
);
// create initial user model object
const newUser = new User(
googleUserId,
userInfo.email,
userInfo.verifiedEmail,
userInfo.name,
userInfo.given_name,
userInfo.family_name,
userInfo.picture,
userInfo.locale,
new Date(),
UserStatus.ONLINE,
new Date()
userInfo.picture,
userInfo.verifiedEmail,
userInfo.locale
);
// create user if not exists
+7 -6
View File
@@ -4,17 +4,18 @@ export class User {
constructor(
public googleId: string, // our Google id that every google user has unique that we are going to use for now
public email: string,
public verifiedEmail: boolean,
public name: string,
public givenName: string,
public familyName: string,
public picture: string,
public locale: string,
public createdDate: Date,
public picture?: string,
public verifiedEmail: boolean = false,
public locale?: string,
// additional properties specific to our users collection
public createdDate: Date,
public status: UserStatus,
public status?: UserStatus,
public lastUpdatedDate?: Date,
public _id?: ObjectId
) {}
@@ -7,6 +7,8 @@ export function useAuthCheck(jwtToken?: string) {
retry: false,
refetchOnWindowFocus: false,
enabled: jwtToken ? true : false,
refetchInterval: 10000,
});
}