mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 15:58:38 +01:00
25 lines
702 B
TypeScript
25 lines
702 B
TypeScript
import { model, Schema, Types } from 'mongoose';
|
|
|
|
export type TEvent = {
|
|
project_id: Schema.Types.ObjectId,
|
|
name: string,
|
|
metadata: Record<string, string>,
|
|
session: string,
|
|
flowHash: string,
|
|
website: 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, index: 1 },
|
|
website: { type: String, index: 1 },
|
|
created_at: { type: Date, default: () => Date.now(), index: true },
|
|
})
|
|
|
|
export const EventModel = model<TEvent>('events', EventSchema);
|
|
|