sites-blog/app/models/core-node.js

48 lines
1.2 KiB
JavaScript
Raw Normal View History

// core-node.js
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const CoreNodeSchema = new Schema({
created: { type: Date, default: Date.now, required: true, index: 1 },
2022-06-30 08:40:35 +00:00
updated: { type: Date, default: Date.now, required: true, index: 1 },
address: {
host: { type: String, required: true },
2022-06-30 08:40:35 +00:00
port: { type: Number, default: 443, min: 1, max: 65535, required: true },
},
2022-06-29 14:21:15 +00:00
flags: {
isConnected: { type: Boolean, default: false, required: true, index: 1 },
2022-06-30 08:40:35 +00:00
isBlocked: { type: Boolean, default: false, required: true, index: 1 },
2022-06-29 14:21:15 +00:00
},
oauth: {
2022-07-04 19:09:22 +00:00
clientId: { type: Schema.ObjectId },
2022-06-29 14:21:15 +00:00
clientSecret: { type: String },
2022-07-04 19:09:22 +00:00
scopes: { type: [String] },
redirectUri: { type: String },
2022-06-29 14:21:15 +00:00
},
kaleidoscope: {
token: { type: String },
},
2022-06-29 14:21:15 +00:00
meta: {
name: { type: String },
description: { type: String },
2022-06-30 08:40:35 +00:00
domain: { type: String },
domainKey: { type: String },
2022-06-29 14:21:15 +00:00
version: { type: String },
admin: { type: String },
supportEmail: { type: String },
},
});
2022-06-30 08:40:35 +00:00
CoreNodeSchema.index({
'address.host': 1,
'address.port': 1,
}, {
name: 'core_address_idx',
});
module.exports = mongoose.model('CoreNode', CoreNodeSchema);