Switch from RabbitMQ to server-sent events

(not fully working yet)
This commit is contained in:
2021-05-03 20:58:40 +02:00
parent 533749c7c8
commit daa7209742
38 changed files with 22158 additions and 672 deletions

View File

@@ -4,8 +4,8 @@ import { IPhone } from '../phone/phone.interface';
export interface IBeat extends Document {
// [latitude, longitude, altitude, accuracy, speed]
coordinate?: number[],
accuracy: number,
speed: number,
accuracy?: number,
speed?: number,
battery?: number,
phone: IPhone,
createdAt?: Date

View File

@@ -8,7 +8,8 @@ export enum ISeverity {
ERROR = 3
}
export type NotificationType = 'beat' | 'phone_alive' | 'phone_dead' | 'phone_register' | 'panic';
export type NotificationType = 'beat' | 'phone_alive' | 'phone_dead' | 'phone_register' | 'panic' | 'test';
export type PublicNotificationType = 'shutdown' | 'restart' | 'warning' | 'error' | 'info';
export interface INotification extends Document {
type: NotificationType;

View File

@@ -13,6 +13,6 @@ export interface IUser extends Document {
type: UserType,
lastLogin: Date,
twoFASecret?: string,
brokerToken: string,
eventToken: string,
createdAt?: Date
}

View File

@@ -6,7 +6,7 @@ const schemaUser = new Schema({
salt: { type: String, required: true },
type: { type: String, required: true, default: 'user' }, // This could be user, admin, guest
twoFASecret: { type: String, required: false },
brokerToken: { type: String, required: true },
eventToken: { type: String, required: true },
lastLogin: { type: Date, required: true, default: Date.now },
}, {
timestamps: {