More Mongoose connections - updated wavesurfer look

This commit is contained in:
Luke Berndt
2024-09-22 21:56:44 -04:00
parent 5817bea3b7
commit 752bb3dfa9
14 changed files with 154 additions and 95 deletions

View File

@@ -1,45 +1,13 @@
var mongoose = require('mongoose');
const callSchema = require('./callSchema');
/*
{ "_id" : ObjectId("5bbc148de26adf00068a0076"), "shortName" : "dcfd", "talkgroupNum" : 11619, "objectKey" : "dcfd-11619-1539052672.m4a", "endpoint" : "nyc3.digitaloceanspaces.com", "bucket" : "openmhz", "time" : ISODate("2018-10-09T02:37:52Z"), "name" : "11619-1539052672.m4a", "freq" : 856987500, "url" : "https://media.openmhz.com/dcfd/2018/10/9/11619-1539052672.m4a", "emergency" : 0, "path" : "/dcfd/2018/10/9/", "srcList" : [ { "pos" : 0, "src" : 1116743 }, { "pos" : 1.8, "src" : 1102467 }, { "pos" : 3.6, "src" : 1116743 } ], "freqList" : [ { "pos" : 0, "freq" : 856987500, "len" : 51744, "errors" : 170, "spikes" : 29 } ], "len" : 6.142 }
*/
var srcSchema = mongoose.Schema({ pos: Number, src: String });
var freqSchema = mongoose.Schema({ pos: Number, freq: Number, len: Number, error: Number, spikes: Number});
var callSchema = mongoose.Schema({
talkgroupNum: Number,
shortName: String,
objectKey: String,
endpoint: String,
bucket: String,
time: Date,
name: String,
freq: Number,
errorCount: Number,
spikeCount: Number,
url: String,
emergency: Boolean,
path: String,
len: Number,
star: {
type: Number,
default: 0
},
srcList: [srcSchema]
});
var frozenCallSchema = mongoose.Schema();
frozenCallSchema.add(callSchema).add({
systemName: String,
systemDescription: String,
talkgroupDescription: String,
talkgroupAlpha: String,
});
exports.frozenCallSchema = frozenCallSchema;
exports.frozenCallModel = mongoose.model('FrozenCall', frozenCallSchema);
exports.callSchema = callSchema;
exports.callModel = mongoose.model('Call', callSchema);
module.exports = mongoose.model('Call', callSchema);

View File

@@ -0,0 +1,27 @@
var mongoose = require('mongoose');
var srcSchema = mongoose.Schema({ pos: Number, src: String });
const callSchema = mongoose.Schema({
talkgroupNum: Number,
shortName: String,
objectKey: String,
endpoint: String,
bucket: String,
time: Date,
name: String,
freq: Number,
errorCount: Number,
spikeCount: Number,
url: String,
emergency: Boolean,
path: String,
len: Number,
star: {
type: Number,
default: 0
},
srcList: [srcSchema]
});
module.exports = callSchema;

View File

@@ -1,5 +1,5 @@
var mongoose = require('mongoose');
var {frozenCallSchema} = require('./call');
const frozenCallSchema = require('./frozenCallSchema');
var eventSchema = mongoose.Schema({

View File

@@ -0,0 +1,4 @@
var mongoose = require('mongoose');
const frozenCallSchema = require('./frozenCallSchema');
module.exports = mongoose.model('FrozenCall', frozenCallSchema);

View File

@@ -0,0 +1,14 @@
var mongoose = require('mongoose');
const callSchema = require('./callSchema');
var frozenCallSchema = mongoose.Schema();
frozenCallSchema.add(callSchema).add({
systemName: String,
systemDescription: String,
talkgroupDescription: String,
talkgroupAlpha: String,
});
module.exports = frozenCallSchema;

View File

@@ -1,37 +1,6 @@
var mongoose = require('mongoose');
var bcrypt = require('bcrypt-nodejs');
var User = require('./user');
const systemSchema = require('./systemSchema');
var systemSchema = mongoose.Schema({
name: String,
shortName: String,
systemType: String,
county: String,
country: String,
city: String,
state: String,
description: String,
status: String,
showScreenName: Boolean,
allowContact: {
type: Boolean,
default: true
},
callAvg: Number,
callCount: Number,
ignoreUnknownTalkgroup : Boolean,
active: {type: Boolean, default: false},
lastActive: Date,
userId: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
key: String
});
systemSchema.methods.generateHash = function(password) {
return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);
};
systemSchema.methods.validPassword = function(password) {
return bcrypt.compareSync(password, this.local.password);
};
exports.systemSchema = systemSchema;
module.exports = mongoose.model('System', systemSchema);

View File

@@ -0,0 +1,37 @@
var mongoose = require('mongoose');
var bcrypt = require('bcrypt-nodejs');
var User = require('./user');
const systemSchema = mongoose.Schema({
name: String,
shortName: String,
systemType: String,
county: String,
country: String,
city: String,
state: String,
description: String,
status: String,
showScreenName: Boolean,
allowContact: {
type: Boolean,
default: true
},
callAvg: Number,
callCount: Number,
ignoreUnknownTalkgroup : Boolean,
active: {type: Boolean, default: false},
lastActive: Date,
userId: {type: mongoose.Schema.Types.ObjectId, ref: 'User'},
key: String
});
systemSchema.methods.generateHash = function(password) {
return bcrypt.hashSync(password, bcrypt.genSaltSync(8), null);
};
systemSchema.methods.validPassword = function(password) {
return bcrypt.compareSync(password, this.local.password);
};
module.exports = systemSchema;

View File

@@ -1,16 +1,4 @@
var mongoose = require('mongoose');
var talkgroupSchema = mongoose.Schema({
shortName: String,
userId: String,
num: Number,
mode: String,
alpha: String,
description: String,
tag: String,
group: String,
priority: Number
});
const talkgroupSchema = require('./talkgroupSchema');
module.exports = mongoose.model('Talkgroup', talkgroupSchema);

View File

@@ -0,0 +1,15 @@
var mongoose = require('mongoose');
const talkgroupSchema = mongoose.Schema({
shortName: String,
userId: String,
num: Number,
mode: String,
alpha: String,
description: String,
tag: String,
group: String,
priority: Number
});
module.exports = talkgroupSchema;