From a0550719fdbff097d9da2cf1fa5d110712229238 Mon Sep 17 00:00:00 2001 From: Flavien David Date: Tue, 5 Mar 2024 15:00:01 +0100 Subject: [PATCH] Add auth0 sub in user model --- front/lib/models/user.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/front/lib/models/user.ts b/front/lib/models/user.ts index 7b86445899d0..c486c6961cdf 100644 --- a/front/lib/models/user.ts +++ b/front/lib/models/user.ts @@ -1,3 +1,4 @@ +import type { UserProviderType } from "@dust-tt/types"; import type { CreationOptional, ForeignKey, @@ -15,8 +16,11 @@ export class User extends Model< declare id: CreationOptional; declare createdAt: CreationOptional; declare updatedAt: CreationOptional; - declare provider: "github" | "google"; - declare providerId: string; + + declare auth0Sub: string | null; + declare provider: UserProviderType; + declare providerId: string | null; + declare username: string; declare email: string; declare name: string; @@ -45,11 +49,16 @@ User.init( }, provider: { type: DataTypes.STRING, - allowNull: false, + allowNull: true, }, providerId: { type: DataTypes.STRING, - allowNull: false, + allowNull: true, + }, + auth0Sub: { + type: DataTypes.STRING, + // TODO(2024-03-01 flav) Set to false once new login flow is released. + allowNull: true, }, username: { type: DataTypes.STRING,