Polarcraft/webv2/server/utils/models.ts

25 lines
629 B
TypeScript

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)