@@ -1,7 +1,6 @@ | |||
const mongoose = require('mongoose'); | |||
const MessageSchema = mongoose.Schema({ | |||
_id: String, | |||
subject: { type: String, required: true }, | |||
message: { type: String, required: true }, | |||
user: { type: String, required: true }, |
@@ -529,7 +529,7 @@ | |||
}, | |||
"finalhandler": { | |||
"version": "1.1.1", | |||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", | |||
"resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", | |||
"integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", | |||
"requires": { | |||
"debug": "2.6.9", | |||
@@ -817,15 +817,15 @@ | |||
} | |||
}, | |||
"mongoose": { | |||
"version": "5.4.3", | |||
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.4.3.tgz", | |||
"integrity": "sha512-zhfypQm63CPYHi43O/3lTcEPVucY3h6CqONbzreMKZIEXtwgkB9HCm4wn441Z9/CpM94G6/NA3wcaRb0N2kPYQ==", | |||
"version": "5.4.10", | |||
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.4.10.tgz", | |||
"integrity": "sha512-yJl+A7p8QF++tyBl6fRGFON5GV57MTXLKNiaiqgX5vZs1qJpcZpPiUGU5odBiqTHFYPybuRp8dW9Qtv4K6SxBQ==", | |||
"requires": { | |||
"async": "2.6.1", | |||
"bson": "~1.1.0", | |||
"kareem": "2.3.0", | |||
"mongodb": "3.1.10", | |||
"mongodb-core": "3.1.9", | |||
"mongodb": "3.1.13", | |||
"mongodb-core": "3.1.11", | |||
"mongoose-legacy-pluralize": "1.0.2", | |||
"mpath": "0.5.1", | |||
"mquery": "3.2.0", | |||
@@ -833,6 +833,28 @@ | |||
"regexp-clone": "0.0.1", | |||
"safe-buffer": "5.1.2", | |||
"sliced": "1.0.1" | |||
}, | |||
"dependencies": { | |||
"mongodb": { | |||
"version": "3.1.13", | |||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.1.13.tgz", | |||
"integrity": "sha512-sz2dhvBZQWf3LRNDhbd30KHVzdjZx9IKC0L+kSZ/gzYquCF5zPOgGqRz6sSCqYZtKP2ekB4nfLxhGtzGHnIKxA==", | |||
"requires": { | |||
"mongodb-core": "3.1.11", | |||
"safe-buffer": "^5.1.2" | |||
} | |||
}, | |||
"mongodb-core": { | |||
"version": "3.1.11", | |||
"resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.1.11.tgz", | |||
"integrity": "sha512-rD2US2s5qk/ckbiiGFHeu+yKYDXdJ1G87F6CG3YdaZpzdOm5zpoAZd/EKbPmFO6cQZ+XVXBXBJ660sSI0gc6qg==", | |||
"requires": { | |||
"bson": "^1.1.0", | |||
"require_optional": "^1.0.1", | |||
"safe-buffer": "^5.1.2", | |||
"saslprep": "^1.0.0" | |||
} | |||
} | |||
} | |||
}, | |||
"mongoose-legacy-pluralize": { |
@@ -23,7 +23,7 @@ | |||
"express": "^4.16.4", | |||
"express-session": "^1.15.6", | |||
"mongodb": "^3.1.10", | |||
"mongoose": "^5.4.3", | |||
"mongoose": "^5.4.10", | |||
"morgan": "^1.9.1", | |||
"vue": "^2.5.17", | |||
"vue-router": "^3.0.2" |
@@ -2,19 +2,23 @@ const CreateMsgRouter = { | |||
template: ` | |||
<div class="card om-card"> | |||
<h5>Neue Nachricht erstellen</h5> | |||
<form class="new-msg-form" action="#" methord="GET"> | |||
<form class="new-msg-form" @submit.prevent=createMsg> | |||
<div class="form-group bmd-form-group"> | |||
<label class="bmd-label-floating">Betreff</label> | |||
<input type="text" class="form-control" id="subject"> | |||
</div> | |||
<div class="form-group bmd-form-group"> | |||
<label class="bmd-label-floating">Tags</label> | |||
<input type="text" class="form-control" id="hashtags"> | |||
<input type="text" class="form-control" id="tag"> | |||
</div> | |||
<div class="form-group"> | |||
<label class="bmd-label-floating">Nachricht</label> | |||
<textarea class="form-control" id="message" rows="5"></textarea> | |||
</div> | |||
<div class="form-group"> | |||
<label class="bmd-label-floating">User</label> | |||
<textarea class="form-control" id="user"></textarea> | |||
</div> | |||
<div class="form-group"> | |||
<div class="checkbox"> | |||
<label> | |||
@@ -31,6 +35,21 @@ const CreateMsgRouter = { | |||
return {}; | |||
}, | |||
methods: { | |||
createMsg: function() { | |||
var subject=$("#subject").val(); | |||
var message=$("#message").val(); | |||
var tag=$("#tag").val(); | |||
var user=$("#user").val(); | |||
console.log ("Message Created: "+id+" "+tag+" "+message+" "+user); | |||
$.ajax ({ url: "/api/createMsg", data: {subject: subject, tag: tag, message: message, user: user}, method: "POST" }) .done (have_result) .fail (have_error); | |||
function have_result (res) { | |||
console.log (res); | |||
} | |||
function have_error (err) { | |||
console.log ("error:" + err.responseText); | |||
console.log (err); | |||
} | |||
}, | |||
}, | |||
mounted: function() { | |||
if ($(this).bootstrapMaterialDesign) |