Files
litlyx/shared_global/schema/aggregation/AggDurationSchema.ts
2025-11-28 16:49:20 +01:00

21 lines
613 B
TypeScript

import { model, Schema } from 'mongoose';
export type TAggDuration = {
project_id: Schema.Types.ObjectId,
domain: string,
from: Date,
to: Date,
data: { _id: { date: Date }, count: number, timestamp: number }[]
}
const AggDurationSchema = new Schema<TAggDuration>({
project_id: { type: Schema.Types.ObjectId, index: true },
domain: { type: String, required: true },
from: { type: Date, required: true },
to: { type: Date, required: true },
data: [{ type: Schema.Types.Mixed }]
});
export const AggDurationModel = model<TAggDuration>('agg_durations', AggDurationSchema);