Migration to Logto: Finished backend user model and final cleanups

This commit is contained in:
2026-03-31 10:34:00 +00:00
parent 49538cfbd4
commit b88253554d

View File

@@ -3,7 +3,8 @@ import mongoose, { Schema, Document } from 'mongoose';
export type UserRole = 'guest' | 'user' | 'admin';
export interface IUser extends Document {
clerkId: string;
clerkId?: string;
logtoId?: string;
email: string;
name: string;
role: UserRole;
@@ -17,8 +18,16 @@ export interface IUser extends Document {
const UserSchema: Schema = new Schema({
clerkId: {
type: String,
required: true,
required: false,
unique: true,
sparse: true,
index: true
},
logtoId: {
type: String,
required: false,
unique: true,
sparse: true,
index: true
},
organizationId: {
@@ -27,7 +36,8 @@ const UserSchema: Schema = new Schema({
},
email: {
type: String,
required: true
required: true,
unique: true
},
name: {
type: String,