Notifications (#1)

This commit is contained in:
2025-05-09 12:46:53 +02:00
committed by GitHub
parent 9423b4804a
commit 5d1c0bc2ba
12 changed files with 73 additions and 122 deletions

View File

@@ -1,4 +1,4 @@
import { ObjectId, Schema, model } from "mongoose"
import { Schema, model } from "mongoose"
export interface GradeNote {
label: string;

View File

@@ -1,8 +1,8 @@
import { ObjectId, Schema, model } from "mongoose"
import { Schema, Types, model } from "mongoose"
interface IKey {
room: string;
whom: ObjectId;
whom: Types.ObjectId;
borrow: Date;
tb?: Date;
}

View File

@@ -1,4 +1,4 @@
import mongoose, { Schema } from "mongoose"
import mongoose, { Types, Schema } from "mongoose"
interface INotification {
endpoint: string;
@@ -6,7 +6,7 @@ interface INotification {
auth: string;
p256dh: string;
};
uname: string
user: Types.ObjectId
expirationTime?: number
}
@@ -16,7 +16,7 @@ const notifSchema = new Schema<INotification>({
auth: String,
p256dh: String,
},
uname: {type: String, required: true},
user: {type: Schema.ObjectId, required: true, ref: "logins"},
expirationTime: Number
})

View File

@@ -1,8 +1,8 @@
import mongoose, { ObjectId, Schema } from "mongoose"
import mongoose, { Types, Schema } from "mongoose"
// TODO: Unify `fname` and `surename` into single field
interface IUser {
export interface IUser {
uname: string;
pass: string;
room?: string;
@@ -10,7 +10,7 @@ interface IUser {
locked?: boolean;
fname?: string;
surname?: string;
groups: ObjectId[];
groups: Types.ObjectId[];
}
const userSchema = new Schema<IUser>({