feat: Added authentication sstem with discord

This commit is contained in:
2023-06-04 22:06:28 +02:00
parent b25699b50b
commit f360dcec8c
11 changed files with 655 additions and 26 deletions

View File

@@ -0,0 +1 @@
export const config = useRuntimeConfig()

View File

@@ -0,0 +1,24 @@
import { Schema, Types, model } from 'mongoose'
const userSchema = new Schema({
username: { type: String, required: true },
usernameType: { type: String, required: true, default: 'discord' },
discord: {
id: { type: String, required: true, unique: true },
username: { type: String, required: true }
},
minecraft: {
uuid: { type: String, required: false, unique: true },
username: { type: String, required: false }
},
role: {
admin: Boolean,
moderator: Boolean,
teamAdmin: Boolean
},
teamInvites: [
Types.ObjectId
]
})
export const UserModel = model<IUser>('User', userSchema)