|
import * as mongoose from 'mongoose'; |
|
import { Document } from 'mongoose'; |
|
import { IUserDocument } from '../user/user.schema'; |
|
import { IPropertyDocument } from '../property/property.schema'; |
|
|
|
export interface IUserActivityDocument extends Document { |
|
|
|
propertyId: IPropertyDocument; |
|
action: string; |
|
sessionId: string; |
|
id: string; |
|
timestamp: Date; |
|
duration?: number; |
|
searchQuery?: string; |
|
} |
|
|
|
const UserActivitySchema = new mongoose.Schema<IUserActivityDocument>( |
|
{ |
|
|
|
|
|
|
|
|
|
|
|
propertyId: { |
|
type: mongoose.Schema.Types.ObjectId, |
|
ref: 'propertie', |
|
|
|
}, |
|
action: { type: String, required: true }, |
|
sessionId: { type: String, required: true }, |
|
id: { type: String }, |
|
searchQuery: { type: String }, |
|
timestamp: { type: Date, default: Date.now }, |
|
duration: { type: Number }, |
|
}, |
|
{ |
|
toJSON: { versionKey: false }, |
|
}, |
|
); |
|
|
|
export { UserActivitySchema }; |
|
|