mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-12 16:57:39 -05:00
More Mongoose connections - updated wavesurfer look
This commit is contained in:
@@ -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);
|
||||
|
||||
27
backend/models/callSchema.js
Normal file
27
backend/models/callSchema.js
Normal 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;
|
||||
@@ -1,5 +1,5 @@
|
||||
var mongoose = require('mongoose');
|
||||
var {frozenCallSchema} = require('./call');
|
||||
const frozenCallSchema = require('./frozenCallSchema');
|
||||
|
||||
|
||||
var eventSchema = mongoose.Schema({
|
||||
|
||||
4
backend/models/frozenCall.js
Normal file
4
backend/models/frozenCall.js
Normal file
@@ -0,0 +1,4 @@
|
||||
var mongoose = require('mongoose');
|
||||
const frozenCallSchema = require('./frozenCallSchema');
|
||||
|
||||
module.exports = mongoose.model('FrozenCall', frozenCallSchema);
|
||||
14
backend/models/frozenCallSchema.js
Normal file
14
backend/models/frozenCallSchema.js
Normal 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;
|
||||
@@ -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);
|
||||
|
||||
37
backend/models/systemSchema.js
Normal file
37
backend/models/systemSchema.js
Normal 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;
|
||||
@@ -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);
|
||||
|
||||
15
backend/models/talkgroupSchema.js
Normal file
15
backend/models/talkgroupSchema.js
Normal 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;
|
||||
Reference in New Issue
Block a user