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 // create initial user model object
const newUser = new User( const newUser = new User(
googleUserId, googleUserId,
userInfo.email, userInfo.email,
userInfo.verifiedEmail,
userInfo.name, userInfo.name,
userInfo.given_name, userInfo.given_name,
userInfo.family_name, userInfo.family_name,
userInfo.picture,
userInfo.locale,
new Date(), new Date(),
UserStatus.ONLINE, userInfo.picture,
new Date() userInfo.verifiedEmail,
userInfo.locale
); );
// create user if not exists // create user if not exists
+7 -6
View File
@@ -4,17 +4,18 @@ export class User {
constructor( constructor(
public googleId: string, // our Google id that every google user has unique that we are going to use for now public googleId: string, // our Google id that every google user has unique that we are going to use for now
public email: string, public email: string,
public verifiedEmail: boolean,
public name: string, public name: string,
public givenName: string, public givenName: string,
public familyName: string, public familyName: string,
public picture: string, public createdDate: Date,
public locale: string, public picture?: string,
public verifiedEmail: boolean = false,
public locale?: string,
// additional properties specific to our users collection // additional properties specific to our users collection
public status?: UserStatus,
public createdDate: Date,
public status: UserStatus,
public lastUpdatedDate?: Date, public lastUpdatedDate?: Date,
public _id?: ObjectId public _id?: ObjectId
) {} ) {}
@@ -7,6 +7,8 @@ export function useAuthCheck(jwtToken?: string) {
retry: false, retry: false,
refetchOnWindowFocus: false, refetchOnWindowFocus: false,
enabled: jwtToken ? true : false, enabled: jwtToken ? true : false,
refetchInterval: 10000,
}); });
} }