All files / lib/models tracking.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24                          16x           16x   16x    
import Crowi from 'server/crowi'
import { Types, Document, Schema, model } from 'mongoose'
 
export interface TrackingDocument extends Document {
  _id: Types.ObjectId
  userAgent: string
  remoteAddress: string
  createdAt: Date
}
 
export default (crowi: Crowi) => {
  // const debug = Debug('crowi:models:tracking')
 
  const trackingSchema = new Schema<TrackingDocument>({
    userAgent: { type: String, required: true },
    remoteAddress: { type: String, required: true },
    createdAt: { type: Date, default: Date.now },
  })
 
  const Tracking = model<TrackingDocument>('Tracking', trackingSchema)
 
  return Tracking
}