feat: add isGuest field in user model

This commit is contained in:
wancat authored and Chen, Tai-Lin committed 2024-07-03 00:34:32 +08:00
1 parent b07b60f6bd
commit 14cd16b611
2 files changed
+7

No files matched your search

+6
View File
@@ -28,6 +28,7 @@ export interface IUser {
socialLogins: Map<string, ISocialLogin> socialLogins: Map<string, ISocialLogin>
createdAt: Date createdAt: Date
updatedAt: Date updatedAt: Date
isGuest: boolean
} }
export const User = model<IUser>( export const User = model<IUser>(
@@ -51,6 +52,11 @@ export const User = model<IUser>(
default: {}, default: {},
required: true, required: true,
}, },
isGuest: {
type: Boolean,
default: false,
required: true,
},
}, },
{ {
timestamps: true, timestamps: true,
+1
View File
@@ -37,6 +37,7 @@ export async function createGuestUser() {
const user = new User({ const user = new User({
username, username,
email: `${username}@example.com`, email: `${username}@example.com`,
isGuest: true,
}) })
await user.save() await user.save()