fix: Changed group assignment.

This commit is contained in:
2025-05-05 18:54:26 +02:00
parent 84244777e2
commit 2dc447a446
6 changed files with 17 additions and 80 deletions

View File

@@ -1,25 +1,27 @@
import mongoose, { Schema } from "mongoose"
import mongoose, { ObjectId, Schema } from "mongoose"
// TODO: Unify `fname` and `surename` into single field
interface IUser {
uname: string;
pass: string;
room?: number;
room?: string;
admin?: number;
locked?: boolean;
fname?: string;
surname?: string;
groups: ObjectId[];
}
const userSchema = new Schema<IUser>({
uname: {type: String, required: true},
pass: {type: String, required: true, default: "$2y$10$wxDhf.XiXkmdKrFqYUEa0.F4Bf.pDykZaMmgjvyLyeRP3E/Xy0hbC"},
room: Number,
room: String,
admin: Number,
locked: {type: Boolean, default: false},
fname: String,
surname: String
surname: String,
groups: [{type: mongoose.Types.ObjectId, ref: "Group"}]
})
export default mongoose.model("logins", userSchema)