add shared

This commit is contained in:
Litlyx
2024-06-01 15:27:21 +02:00
parent 9caec3b92b
commit 75f0787c3b
23 changed files with 866 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import { model, Schema, Types } from 'mongoose';
export type TEvent = {
project_id: Schema.Types.ObjectId,
name: string,
metadata: Record<string, string>,
created_at: Date
}
const EventSchema = new Schema<TEvent>({
project_id: { type: Types.ObjectId, index: 1 },
name: { type: String, required: true },
metadata: Schema.Types.Mixed,
created_at: { type: Date, default: () => Date.now() },
})
export const EventModel = model<TEvent>('events', EventSchema);