mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
40 lines
850 B
TypeScript
40 lines
850 B
TypeScript
import { model, Schema } from 'mongoose';
|
|
|
|
export type TVisit = {
|
|
project_id: Schema.Types.ObjectId,
|
|
|
|
browser: string,
|
|
os: string,
|
|
|
|
continent: string,
|
|
country: string,
|
|
|
|
device: string,
|
|
|
|
website: string,
|
|
page: string,
|
|
referrer: string,
|
|
|
|
created_at: Date
|
|
}
|
|
|
|
const VisitSchema = new Schema<TVisit>({
|
|
project_id: { type: Schema.Types.ObjectId, index: 1 },
|
|
|
|
browser: { type: String, required: true },
|
|
os: { type: String, required: true },
|
|
|
|
continent: { type: String },
|
|
country: { type: String },
|
|
|
|
device: { type: String },
|
|
|
|
website: { type: String, required: true },
|
|
page: { type: String, required: true },
|
|
referrer: { type: String, required: true },
|
|
created_at: { type: Date, default: () => Date.now() },
|
|
})
|
|
|
|
export const VisitModel = model<TVisit>('visits', VisitSchema);
|
|
|