Fixed the Mongoos schema for Stats

This commit is contained in:
Luke Berndt
2023-04-10 08:44:38 -04:00
parent fd779e91da
commit e8ee26ad4a
2 changed files with 27 additions and 10 deletions

View File

@@ -1,10 +1,27 @@
var mongoose = require('mongoose');
let decodeErrorSchema = mongoose.Schema({
errorHistory: [Number],
spikeHistory: [Number],
})
let talkgroupStatsSchema = mongoose.Schema({
callCountHistory: [Number],
callAvgLenHistory: [Number]
})
var systemStatSchema = mongoose.Schema({
callTotals: [Number],
errorTotals: [Number],
usageBytes: Number,
usageMb: Number,
uploadErrors: [Number],
decodeErrorsFreq: {
type: Map,
of: decodeErrorSchema
},
talkgroupStats: {
type: Map,
of: talkgroupStatsSchema
},
shortName: String
}, { collection: 'system_stats' });