(domainId?: string)
| 62 | |
| 63 | @ArgMethod |
| 64 | static async stat(domainId?: string) { |
| 65 | const [d5min, d1h, day, week, month, year, total] = await Promise.all([ |
| 66 | RecordModel.coll.countDocuments({ _id: { $gte: Time.getObjectID(moment().add(-5, 'minutes')) }, ...domainId ? { domainId } : {} }), |
| 67 | RecordModel.coll.countDocuments({ _id: { $gte: Time.getObjectID(moment().add(-1, 'hour')) }, ...domainId ? { domainId } : {} }), |
| 68 | RecordModel.coll.countDocuments({ _id: { $gte: Time.getObjectID(moment().add(-1, 'day')) }, ...domainId ? { domainId } : {} }), |
| 69 | RecordModel.coll.countDocuments({ _id: { $gte: Time.getObjectID(moment().add(-1, 'week')) }, ...domainId ? { domainId } : {} }), |
| 70 | RecordModel.coll.countDocuments({ _id: { $gte: Time.getObjectID(moment().add(-1, 'month')) }, ...domainId ? { domainId } : {} }), |
| 71 | RecordModel.coll.countDocuments({ _id: { $gte: Time.getObjectID(moment().add(-1, 'year')) }, ...domainId ? { domainId } : {} }), |
| 72 | domainId ? RecordModel.coll.countDocuments({ domainId }) : RecordModel.coll.estimatedDocumentCount(), |
| 73 | ]); |
| 74 | return { |
| 75 | d5min, d1h, day, week, month, year, total, |
| 76 | }; |
| 77 | } |
| 78 | |
| 79 | static async judge( |
| 80 | domainId: string, rids: MaybeArray<ObjectId> | RecordDoc, priority = 0, |
no test coverage detected