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

87 lines
1.1 KiB
TypeScript

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()
applicationLog!: {
@Column()
type!: Schema.Types.Object;
@Column()
ref!: 'ApplicationLog';
@Column()
alias!: 'applicationLog';
@Column()
index!: true;
}; //Which application log this content log belongs to.
@Column()
content!: Object;
@Column()
stringifiedContent!: string;
@Column()
type!: {
@Column()
type!: string;
@Column()
enum!: ['info', 'warning', 'error'];
@Column()
required!: true;
};
@Column()
tags!: [
{
@Column()
type!: string;
};
];
@Column()
createdByUser!: User;
@Column()
deletedByUser!: User;
}
schema.virtual('applicationLog'; {
@Column()
localField!: '_id';
@Column()
foreignField!: 'applicationLog';
@Column()
ref!: 'ApplicationLog';
@Column()
justOne!: true;
}