ptzoptics-node-server/app/camera/camera.model.js

31 lines
904 B
JavaScript
Raw Normal View History

2018-11-02 15:24:39 -04:00
/*jshint esversion: 6 */
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const schema = new Schema({
_id: Schema.Types.ObjectId,
ip: {type: String, unique: true, required: true},
port: {type: String, required: true},
rtsp: {type: String, required: true},
model: {type: String, required: true},
serial: {type: String, required: true},
name: {type: String, unique: true},
streamPort: {type: Number, unique: true},
presets: [
{
memNum: {type: Number, max: 127},
name: {type: String},
location: {
pan: {type: String},
tilt: {type: String},
focus: {type: String},
zoom: {type: String}
}
}
]
});
schema.set('toJson', {virtuals: true});
module.exports = mongoose.model('Camera', schema);