mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
add shared
This commit is contained in:
18
shared/schema/metrics/EventSchema.ts
Normal file
18
shared/schema/metrics/EventSchema.ts
Normal 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);
|
||||
|
||||
Reference in New Issue
Block a user