diff --git a/src/controllers/calendarController.ts b/src/controllers/calendarController.ts index 44efca0..faefee9 100644 --- a/src/controllers/calendarController.ts +++ b/src/controllers/calendarController.ts @@ -420,6 +420,20 @@ export async function UnlinkGoogleCalendar(req: Request, res: Response) { userId: userSession.user_id, }); + // set user google account data to null + + await User.update( + { + google_account_name: "", + google_account_picture: "", + }, + { + where: { + user_id: userSession.user_id, + }, + } + ); + res.status(200).send({ msg: "success" }); } catch (error) { logger.error(error); diff --git a/src/models/user.ts b/src/models/user.ts index b346b58..36638d0 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -93,7 +93,7 @@ User.init( }, google_account_picture: { type: DataTypes.STRING, - allowNull: true, + allowNull: true, // varchar(1050) needs to be set manually }, analytics_enabled: { type: DataTypes.BOOLEAN,