Andrew commited on
Commit
50d46fe
·
1 Parent(s): b4b34c7

feat(types): generalize User schema for multiple auth providers

Browse files
Files changed (1) hide show
  1. src/lib/types/User.ts +10 -1
src/lib/types/User.ts CHANGED
@@ -1,6 +1,8 @@
1
  import type { ObjectId } from "mongodb";
2
  import type { Timestamps } from "./Timestamps";
3
 
 
 
4
  export interface User extends Timestamps {
5
  _id: ObjectId;
6
 
@@ -8,7 +10,14 @@ export interface User extends Timestamps {
8
  name: string;
9
  email?: string;
10
  avatarUrl: string | undefined;
11
- hfUserId: string;
 
 
 
 
 
 
 
12
  isAdmin?: boolean;
13
  isEarlyAccess?: boolean;
14
  }
 
1
  import type { ObjectId } from "mongodb";
2
  import type { Timestamps } from "./Timestamps";
3
 
4
+ export type AuthProvider = "huggingface" | "password" | "oidc";
5
+
6
  export interface User extends Timestamps {
7
  _id: ObjectId;
8
 
 
10
  name: string;
11
  email?: string;
12
  avatarUrl: string | undefined;
13
+
14
+ // Auth provider identification
15
+ authProvider: AuthProvider;
16
+ authId: string; // Provider-specific user ID (e.g., hfUserId for HF, username for password)
17
+
18
+ // Legacy field for backward compatibility (maps to authId when authProvider is "huggingface")
19
+ hfUserId?: string;
20
+
21
  isAdmin?: boolean;
22
  isEarlyAccess?: boolean;
23
  }