The DTP Sites web app development engine.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

37 lines
1.2 KiB

// core-node-request.js
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
/*
* Used for authenticating responses received and gathering performance and use
* metrics for communications with Cores.
*
* When a request is created, an authentication token is generated and
* information about the request is stored. This also provides the request ID.
*
* When a resonse is received for a request, this record is fetched. The token
* claimed status and value are checked. Information about the response is
* recorded, and request execution time information is recorded.
*/
const CoreNodeRequestSchema = new Schema({
created: { type: Date, default: Date.now, required: true, index: 1 },
core: { type: Schema.ObjectId, required: true, ref: 'CoreNode' },
token: {
value: { type: String, required: true },
claimed: { type: Boolean, default: false, required: true },
},
url: { type: String },
response: {
received: { type: Date },
elapsed: { type: Number },
isError: { type: Boolean, default: false },
},
});
module.exports = mongoose.model('CoreNodeRequest', CoreNodeRequestSchema);