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.
38 lines
1.0 KiB
38 lines
1.0 KiB
3 years ago
|
const Connections = require("../models/CreateConnections");
|
||
|
const User = require("../models/User");
|
||
|
const boom = require("boom");
|
||
|
const fastify = require("fastify")({
|
||
|
logger: true,
|
||
|
});
|
||
|
|
||
|
|
||
|
// add new tanks
|
||
|
exports.createConnections = async (req, reply) => {
|
||
|
try {
|
||
|
|
||
|
//const username = loginObject.user.username;
|
||
|
|
||
|
createConnections = {
|
||
|
//userName: username,
|
||
|
source: req.body.source,
|
||
|
inputConnections: req.body.inputConnections,
|
||
|
outputConnections:req.body.outputConnections,
|
||
|
};
|
||
|
|
||
|
var connections = new Connections(createConnections);
|
||
|
|
||
|
checkFormEncoding = isUserFormUrlEncoded(req);
|
||
|
if (checkFormEncoding.isUserFormUrlEncoded) {
|
||
|
usertobeInserted = checkFormEncoding.connections;
|
||
|
connections.source = usertobeInserted.source;
|
||
|
connections.inputConnections = req.body.inputConnections;
|
||
|
connections.outputConnections = req.body.outputConnections;
|
||
|
}
|
||
|
const insertedConnection = await connections.save();
|
||
|
return insertedConnection;
|
||
|
|
||
|
} catch (err) {
|
||
|
throw boom.boomify(err);
|
||
|
}
|
||
|
};
|