blob: 4e5dd692758e1d585fb9648e9872547995f88b68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import { Schema, Document } from 'mongoose';
export interface EventDocument<Context> extends Document {
name: string;
schedule: string;
status: 'notStarted' | 'running' | 'complete' | 'failed';
error?: string;
context: Context;
nextRunAt: Date;
lastRunAt: Date;
}
const createEventSchema = (contextSchema: Schema) => new Schema({
name: {
type: String,
required: true,
unique: true
},
schedule: {
type: String,
required: true
},
status: {
type: String,
default: 'notStarted'
},
error: String,
context: contextSchema,
nextRunAt: Date,
lastRunAt: Date
}, { timestamps: true });
export default createEventSchema;
|