Migration to Logto: Finished backend user model and final cleanups
This commit is contained in:
@@ -3,7 +3,8 @@ import mongoose, { Schema, Document } from 'mongoose';
|
|||||||
export type UserRole = 'guest' | 'user' | 'admin';
|
export type UserRole = 'guest' | 'user' | 'admin';
|
||||||
|
|
||||||
export interface IUser extends Document {
|
export interface IUser extends Document {
|
||||||
clerkId: string;
|
clerkId?: string;
|
||||||
|
logtoId?: string;
|
||||||
email: string;
|
email: string;
|
||||||
name: string;
|
name: string;
|
||||||
role: UserRole;
|
role: UserRole;
|
||||||
@@ -17,8 +18,16 @@ export interface IUser extends Document {
|
|||||||
const UserSchema: Schema = new Schema({
|
const UserSchema: Schema = new Schema({
|
||||||
clerkId: {
|
clerkId: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: false,
|
||||||
unique: true,
|
unique: true,
|
||||||
|
sparse: true,
|
||||||
|
index: true
|
||||||
|
},
|
||||||
|
logtoId: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
unique: true,
|
||||||
|
sparse: true,
|
||||||
index: true
|
index: true
|
||||||
},
|
},
|
||||||
organizationId: {
|
organizationId: {
|
||||||
@@ -27,7 +36,8 @@ const UserSchema: Schema = new Schema({
|
|||||||
},
|
},
|
||||||
email: {
|
email: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true,
|
||||||
|
unique: true
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user