oneuptime/Common/Models/Subscriber.ts
Simon Larsen f0c0715f36
fix
2022-04-29 20:52:23 +01:00

99 lines
1.3 KiB
TypeScript
Executable File

import { Column, Entity, Index } from 'typeorm';
import BaseModel from './BaseModel';
import User from './User';
import Project from './Project';
@Entity({
name: "UserAlerts"
})
export default class Model extends BaseModel{
@Column()
monitor: Monitor;
@Column()
project: Project;
@Column()
statusPage!: {
@Column()
type!: Schema.Types.Object;
@Column()
ref!: 'StatusPage';
@Column()
index!: true;
};
@Column()
alertVia!: {
@Column()
type!: string;
@Column()
enum!: ['sms', 'email', 'webhook'];
@Column()
required!: true;
};
@Column()
contactEmail!: string;
@Column()
contactPhone!: string;
@Column()
countryCode!: string;
@Column()
contactWebhook!: string;
@Column()
webhookMethod!: {
@Column()
type!: string;
@Column()
enum!: ['get', 'post'];
@Column()
required!: true;
};
@Column()
notificationType!: {
@Column()
incident!: boolean;
@Column()
announcement!: boolean;
@Column()
scheduledEvent!: boolean;
};
@Column()
createdAt: { type: Date; default!: Date.now }
@Column()
subscribed!: boolean;
@Column()
deletedByUser!: User;
}