change consumer

This commit is contained in:
Emily
2025-01-31 14:58:46 +01:00
parent 0dd94be6e6
commit 487c3ac7b4
24 changed files with 531 additions and 47 deletions

View File

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