Commit edeeb595 authored by Corentin Mors's avatar Corentin Mors
Browse files

Merge branch 'develop'

parents 4d5bb03e e4b19690
......@@ -34,6 +34,8 @@ var resources = require('./models/resources');
var listes = require('./models/checklists');
var source = require('./models/sources');
var datacenter = require('./models/datacenters');
var tache = require('./models/tasks');
// Load templating and statics
app.use(express.static(path.join(__dirname, 'public')));
......
var express = require('express'),
router = express.Router(),
mongoose = require('mongoose');
mongoose = require('mongoose'),
Task = mongoose.model('Task');
//GET all checklists
exports.list_checklists = function(req, res, next) {
......@@ -60,6 +61,55 @@ mongoose = require('mongoose');
})
};
//POST a new resource
exports.add_task = function(req, res) {
// Get values from POST request. These can be done through forms or REST calls. These rely on the "name" attributes for forms
var title = req.body.title;
var description = req.body.description;
var checked = false;
var deadline = req.body.deadline;
mongoose.model('Task').create({
_id : new mongoose.Types.ObjectId(),
title: title,
description: description,
checked: checked,
deadline: deadline
}, function(err, tmpTask)
{
if (err) {
console.log(err);
} else {
console.log("ceujkfdgbluzeyuilfzge " + tmpTask);
mongoose.model('Checklist').findByIdAndUpdate(req.params.id, {$push: {task: tmpTask}}, function(err, checklist) {
if(err){
console.log(err);
console.log(checklist);
res.send("There was a problem adding the information to the database.");
} else {
console.log(checklist);
res.format({
//HTML response will set the location and redirect back to the home page. You could also create a 'success' page if that's your thing
html: function(){
// If it worked, set the header so the address bar doesn't still say /adduser
res.location("checklists");
// And forward to success page
res.redirect("/checklists/"+req.params.id);
},
//JSON response will show the newly created user
json: function(){
res.json(checklist);
}
})
}}
)
}
});
};
exports.view_checklist = function(req, res) {
mongoose.model('Checklist').findById(req.params.id, function (err, checklist) {
if (err) {
......@@ -70,7 +120,8 @@ mongoose = require('mongoose');
html: function(){
res.render('checklists/view', {
title: 'View of ' + checklist.title,
checklist : checklist
checklist : checklist,
tasks : checklist.task
});
},
json: function(){
......@@ -116,10 +167,10 @@ mongoose = require('mongoose');
console.log(req.body);
//find the document by ID
mongoose.model('Description').findByIdAndUpdate(id, {
mongoose.model('Checklist').findByIdAndUpdate(id, {
title : title,
description : description
}, function (err, description) {
}, function (err, checklist) {
if (err) {
res.send("There was a problem updating the information to the database: " + err);
}
......@@ -127,11 +178,11 @@ mongoose = require('mongoose');
//HTML responds by going back to the page or you can be fancy and create a new view that shows a success page.
res.format({
html: function(){
res.redirect("/descriptions/" + description._id);
res.redirect("/checklists/" + checklist._id);
},
//JSON responds showing the updated values
json: function(){
res.json(description);
res.json(checklist);
}
});
}
......
......@@ -23,10 +23,10 @@ exports.welcome = function(req, res) {
// Login and logout functions
exports.getLogin = function(req, res, next) {
res.render('login', {error: next});
}
res.render('login', {error: next});
}
exports.postLogin = function(req, res){
exports.postLogin = function(req, res, next){
users.authenticate(req.body.email, req.body.password, function (error, user) {
if (error || !user) {
var err = new Error('Wrong email or password.');
......
var express = require('express'),
router = express.Router(),
mongoose = require('mongoose');
//GET all checklists
exports.list_tasks = function(req, res, next) {
//retrieve all checklists from Monogo
mongoose.model('Task').find({}, function (err, tasks) {
if (err) {
return console.error(err);
} else {
//respond to both HTML and JSON. JSON responses require 'Accept: application/json;' in the Request Header
res.format({
//HTML response will render the users/index.html
html: function(){
res.render('./tasks/list', {
title: 'Tasks list',
tasks: tasks
});
},
//JSON response will show all users in JSON format
json: function(){
res.json(tasks);
}
});
}
});
}
//POST a new resource
exports.add_task = function(req, res) {
// Get values from POST request. These can be done through forms or REST calls. These rely on the "name" attributes for forms
var title = req.body.title;
var description = req.body.description;
var checked = false;
var deadline = req.body.deadline;
//call the create function for our database
mongoose.model('task').create({
_id : new mongoose.Types.ObjectId(),
title : title,
description : description,
checked : checked,
deadline : deadline
}, function (err, task) {
if (err) {
res.send("There was a problem adding the information to the database.");
} else {
//resource has been created
res.format({
//HTML response will set the location and redirect back to the home page. You could also create a 'success' page if that's your thing
html: function(){
// If it worked, set the header so the address bar doesn't still say /adduser
res.location("tasks");
// And forward to success page
res.redirect("/tasks");
},
//JSON response will show the newly created user
json: function(){
res.json(tasks);
}
});
}
})
};
//GET the individual user by Mongo ID
exports.edit_task = function(req, res) {
//search for the user within Mongo
mongoose.model('Task').findById(req.params.id, function (err, task) {
if (err) {
console.log('GET Error: There was a problem retrieving: ' + err);
} else {
//Return the user
console.log('GET Retrieving ID: ' + task._id);
res.format({
//HTML response will render the 'edit.jade' template
html: function(){
res.render('tasks/edit', {
title: 'Edit task #' + task._id,
task : task
});
},
//JSON response will return the JSON output
json: function(){
res.json(task);
}
});
}
});
};
//POST to update a user by ID
exports.post_edit_task = function(req, res) {
// Get our REST and form values.
var id = req.params.id;
var title = req.body.title;
var description = req.body.description;
var checked = req.body.checked;
var deadline = req.body.deadline;
console.log(req.body);
//find the document by ID
mongoose.model('Task').findByIdAndUpdate(id, {
title : title,
description : description,
checked : checked,
deadline : deadline
}, function (err, task) {
if (err) {
res.send("There was a problem updating the information to the database: " + err);
}
else {
//HTML responds by going back to the page or you can be fancy and create a new view that shows a success page.
res.format({
html: function(){
res.redirect("/tasks/" + task._id);
},
//JSON responds showing the updated values
json: function(){
res.json(task);
}
});
}
})
};
//DELETE a Users by ID
exports.delete_task = function (req, res){
//find user by ID
mongoose.model('Task').findById(req.params.id, function (err, task) {
if (err) {
return console.error(err);
} else {
//remove it from Mongo
task.remove(function (err, task) {
if (err) {
return console.error(err);
} else {
//Returning success messages saying it was deleted
console.log('DELETE removing ID: ' + task._id);
res.format({
//HTML returns us back to the main page, or you can create a success page
html: function(){
res.redirect("/tasks");
},
//JSON returns the item with the message that is has been deleted
json: function(){
res.json({message : 'deleted',
item : task
});
}
});
}
});
}
});
};
\ No newline at end of file
var mongoose = require('mongoose');
const Schema = mongoose.Schema;
const ObjectId = Schema.ObjectId;
var taskSchema = require('./tasks').schema;
const checklistSchema = new Schema({
_id: ObjectId,
task: [{type: ObjectId, ref: 'task'}],
task: [taskSchema],
title: {
type: String,
required: true
......
......@@ -18,3 +18,4 @@ const taskSchema = new Schema({
});
var Task = mongoose.model('Task', taskSchema);
module.exports = Task;
......@@ -114,6 +114,10 @@ body {
color: #fff;
}
.breadcrumb
{
display: block;
}
.dashboard .card-body {
background: #449644;
......@@ -146,7 +150,7 @@ body {
animation-iteration-count: infinite;
}
@-webkit-keyframes beating {
0% {transform: scale(0.1,0.1);}
10% {transform: scale(0.3,0.3)}
......@@ -260,7 +264,7 @@ a[aria-expanded="true"] {
.sameHauteur{
align-items: center;
}
/** dark CSS */
.dark {
......
$("#darkButton").click(function(){$("body").hasClass("dark")?$("body").removeClass("dark"):$("body").addClass("dark")}),$(document).ready(function(){var a=new Date;$("#live-hour").html("<i class='far fa-clock'></i> "+a);var o=a.getHours();(o>17||o<8)&&$("body").addClass("dark")}),$(document).ready(function(){$("#sidebar").mCustomScrollbar({theme:"minimal"}),$("#sidebarCollapse").on("click",function(){$("#sidebar, #content").toggleClass("active"),$(".collapse.in").toggleClass("in"),$("a[aria-expanded=true]").attr("aria-expanded","false")})}),$(document).ready(function(){var a,o,e;if("geolocation"in navigator){navigator.geolocation.getCurrentPosition(function(t){a=t.coords.latitude,o=t.coords.longitude,e="http://api.openweathermap.org/data/2.5/weather?lat="+a+"&lon="+o+"&units=metric&appid=b231606340553d9174136f7f083904b3",$.ajax({url:e,method:"GET",success:function(a){var o=a.main.temp,e=a.name;a.weather.description;$("#live-weather").html(o+"°C in "+e)}})})}else console.log("Your browser doesn't support geolocation. Sorry.")});
\ No newline at end of file
$("#darkButton").click(function(){$("body").hasClass("dark")?($("body").removeClass("dark"),$("#xcockpit_logo").attr("src","/assets/img/Logo_X-Cockpit_earth.svg")):($("body").addClass("dark"),$("#xcockpit_logo").attr("src","/assets/img/Logo_X-Cockpit_moon.svg"))}),$(document).ready(function(){var o=new Date;$("#live-hour").html("<i class='far fa-clock'></i> "+o);var a=o.getHours();(a>17||a<8)&&($("body").addClass("dark"),$("#xcockpit_logo").attr("src","/assets/img/Logo_X-Cockpit_moon.svg"))}),$(document).ready(function(){$("#sidebar").mCustomScrollbar({theme:"minimal"}),$("#sidebarCollapse").on("click",function(){$("#sidebar, #content").toggleClass("active"),$(".collapse.in").toggleClass("in"),$("a[aria-expanded=true]").attr("aria-expanded","false")})}),$(document).ready(function(){var o,a,t;if("geolocation"in navigator){navigator.geolocation.getCurrentPosition(function(e){o=e.coords.latitude,a=e.coords.longitude,t="https://api.openweathermap.org/data/2.5/weather?lat="+o+"&lon="+a+"&units=metric&appid=b231606340553d9174136f7f083904b3",$.ajax({url:t,method:"GET",success:function(o){var a=o.main.temp,t=o.name;o.weather.description;$("#live-weather").html(a+"°C in "+t)}})})}else console.log("Your browser doesn't support geolocation. Sorry.")});
\ No newline at end of file
body{padding-top:5rem;background-color:#fff}.footer-text{display:block;text-align:center}.contenttype-title{display:flex}.contenttype-title h3{flex:1 0}.contenttype-all-button{margin-top:5px}.list-group-item-flex{display:flex}.list-group-item-tools{display:block;width:30px}.list-group-item-image{margin-right:10px}.list-group-item-content{flex:1 0}.box{margin-bottom:20px;border:2px solid #000;border-radius:6px;line-height:40px;text-align:center;padding-top:10px;background-color:#c3cee4}.content-input{height:500px}.article{padding-left:1rem;padding-bottom:1rem}[class*=col-xs]{width:auto}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto;align-items:center}@media (min-width:768px){.container{width:1170px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}#accordion-faq .card{margin-bottom:10px}.content-box{display:flex;margin:0 0 45px;padding:30px;background-color:#9d9d9d;color:#fff}.dashboard .card-body{background:#449644;display:flex;justify-content:center;width:auto}.card-body-item{height:100%;width:100%}.card-body-item:nth-child(1){break-after:always}.card-body-item span{font-size:2.5em;color:#fff}.wrapper{display:flex;width:100%}#sidebar{width:250px;margin-left:-250px;position:fixed;top:0;left:0;height:100vh;z-index:999;background:#7386d5;color:#fff;transition:all .3s}#sidebar.active{margin-left:0}#sidebar .sidebar-header{padding:20px;background:#6d7fcc}#sidebar ul.components{padding:20px 0;border-bottom:1px solid #47748b}#sidebar ul p{color:#fff;padding:10px}#sidebar ul li a{text-decoration:none;color:#fff;padding:10px;font-size:1.1em;display:block}#sidebar ul li a:hover{color:#7386d5;background:#fff}#sidebar ul li.active>a,a[aria-expanded=true]{color:#fff;background:#6d7fcc}#content{width:100%;padding:40px;min-height:100vh;transition:all .3s;position:absolute;top:0;right:0}#content.active{width:calc(100% - 250px)}.content-input{height:500px}.task{padding:2px;margin-top:10px;border-radius:5px;border:2px solid #112f41}.sameHauteur{align-items:center}.dark{background-color:#112f41;color:#fff}.dark .task{border-color:#878787}.dark .modal-content{background-color:#1e4363}.dark .btn{background-color:#1c88cc}.dark .dropdown-menu{background-color:#1e4363}.dark .dropdown-item{color:#fff}.dark .card{background-color:#1e4363}.dark .breadcrumb{background-color:#1e4363}.dark a{color:#fff}.dark .btn-link{color:#fff}.dark .card .btn{background-color:transparent}
\ No newline at end of file
body{padding-top:5rem;background-color:#fff}.footer-text{display:block;text-align:center}.contenttype-title{display:flex}.contenttype-title h3{flex:1 0}.contenttype-all-button{margin-top:5px}.list-group-item-flex{display:flex}.list-group-item-tools{display:block;width:30px}.list-group-item-image{margin-right:10px}.list-group-item-content{flex:1 0}.box{margin-bottom:20px;border:2px solid #000;border-radius:6px;line-height:40px;text-align:center;padding-top:10px;background-color:#c3cee4}.content-input{height:500px}.article{padding-left:1rem;padding-bottom:1rem}[class*=col-xs]{width:auto}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto;align-items:center}@media (min-width:768px){.container{width:1170px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}#accordion-faq .card{margin-bottom:10px}.content-box{display:flex;margin:0 0 45px;padding:30px;background-color:#9d9d9d;color:#fff}.breadcrumb{display:block}.dashboard .card-body{background:#449644;display:flex;justify-content:center;width:auto}.card-body-item{height:100%;width:100%}.card-body-item:nth-child(1){break-after:always}.card-body-item span{font-size:2.5em;color:#fff}.wrapper{display:flex;width:100%}#sidebar{width:250px;margin-left:-250px;position:fixed;top:0;left:0;height:100vh;z-index:999;background:#7386d5;color:#fff;transition:all .3s}#sidebar.active{margin-left:0}#sidebar .sidebar-header{padding:20px;background:#6d7fcc}#sidebar ul.components{padding:20px 0;border-bottom:1px solid #47748b}#sidebar ul p{color:#fff;padding:10px}#sidebar ul li a{text-decoration:none;color:#fff;padding:10px;font-size:1.1em;display:block}#sidebar ul li a:hover{color:#7386d5;background:#fff}#sidebar ul li.active>a,a[aria-expanded=true]{color:#fff;background:#6d7fcc}#content{width:100%;padding:40px;min-height:100vh;transition:all .3s;position:absolute;top:0;right:0}#content.active{width:calc(100% - 250px)}.content-input{height:500px}.task{padding:2px;margin-top:10px;border-radius:5px;border:2px solid #112f41}.sameHauteur{align-items:center}.dark{background-color:#112f41;color:#fff}.dark .task{border-color:#878787}.dark .modal-content{background-color:#1e4363}.dark .btn{background-color:#1c88cc}.dark .dropdown-menu{background-color:#1e4363}.dark .dropdown-item{color:#fff}.dark .card{background-color:#1e4363}.dark .breadcrumb{background-color:#1e4363}.dark a{color:#fff}.dark .btn-link{color:#fff}.dark .card .btn{background-color:transparent}
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 479.44 472"><defs><style>.cls-1{isolation:isolate;}.cls-2{fill:#fafbfb;}.cls-3{fill:#e0e0e0;}.cls-4{fill:#bdbdbd;}.cls-5{fill:#f5f5f5;}.cls-6{fill:#212121;opacity:0.1;mix-blend-mode:multiply;}.cls-7{fill:#707070;}</style></defs><title>Logo_X-Cockpit_moon</title><g class="cls-1"><g id="Logo"><g id="Lune"><circle class="cls-2" cx="212" cy="260" r="212"/><circle class="cls-3" cx="78.61" cy="184.11" r="33.37"/><path class="cls-4" d="M108.37,251a33.36,33.36,0,0,1,55.5-25,33.37,33.37,0,1,0-47.1,47.1A33.24,33.24,0,0,1,108.37,251Z" transform="translate(-60.28 -64)"/><path class="cls-5" d="M140.2,214.73l-.66,0a33.37,33.37,0,1,1-34,34c0,.22,0,.44,0,.66a34.69,34.69,0,1,0,34.69-34.69Z" transform="translate(-60.28 -64)"/><circle class="cls-3" cx="300.25" cy="125.64" r="16.69"/><path class="cls-4" d="M345.27,191.06A16.68,16.68,0,0,1,373,178.58a16.68,16.68,0,1,0-23.55,23.55A16.62,16.62,0,0,1,345.27,191.06Z" transform="translate(-60.28 -64)"/><path class="cls-5" d="M361.19,173h-.33a16.68,16.68,0,1,1-17,17c0,.11,0,.22,0,.33A17.34,17.34,0,1,0,361.19,173Z" transform="translate(-60.28 -64)"/><circle class="cls-3" cx="358.65" cy="294.87" r="41.64"/><path class="cls-4" d="M380.85,362.43a41.63,41.63,0,0,1,69.24-31.16A41.63,41.63,0,1,0,391.32,390,41.47,41.47,0,0,1,380.85,362.43Z" transform="translate(-60.28 -64)"/><path class="cls-5" d="M420.57,317.23l-.82,0a41.63,41.63,0,1,1-42.44,42.44c0,.27,0,.55,0,.82a43.28,43.28,0,1,0,43.28-43.28Z" transform="translate(-60.28 -64)"/><circle class="cls-3" cx="247.38" cy="392.15" r="41.64"/><path class="cls-4" d="M269.58,459.71a41.63,41.63,0,0,1,69.24-31.16,41.63,41.63,0,1,0-58.77,58.77A41.47,41.47,0,0,1,269.58,459.71Z" transform="translate(-60.28 -64)"/><path class="cls-5" d="M309.3,414.51l-.82,0A41.63,41.63,0,1,1,266,457c0,.27,0,.55,0,.82a43.28,43.28,0,1,0,43.28-43.28Z" transform="translate(-60.28 -64)"/><circle class="cls-3" cx="164.95" cy="366.85" r="23.45"/><path class="cls-4" d="M203.78,432.86a23.44,23.44,0,0,1,39-17.55,23.44,23.44,0,1,0-33.09,33.09A23.35,23.35,0,0,1,203.78,432.86Z" transform="translate(-60.28 -64)"/><path class="cls-5" d="M226.15,407.4h-.46a23.44,23.44,0,1,1-23.9,23.9c0,.15,0,.31,0,.46a24.37,24.37,0,1,0,24.37-24.37Z" transform="translate(-60.28 -64)"/><circle class="cls-3" cx="208.56" cy="334.42" r="14.19"/><path class="cls-4" d="M255.86,399.64A14.19,14.19,0,0,1,279.46,389a14.19,14.19,0,1,0-20,20A14.14,14.14,0,0,1,255.86,399.64Z" transform="translate(-60.28 -64)"/><path class="cls-5" d="M269.4,384.23h-.28a14.19,14.19,0,1,1-14.47,14.47c0,.09,0,.19,0,.28a14.75,14.75,0,1,0,14.75-14.75Z" transform="translate(-60.28 -64)"/><circle class="cls-3" cx="397.1" cy="236.05" r="16.05"/><path class="cls-4" d="M442.7,301.42a16,16,0,0,1,26.69-12,16,16,0,1,0-22.66,22.66A16,16,0,0,1,442.7,301.42Z" transform="translate(-60.28 -64)"/><path class="cls-5" d="M458,284h-.32a16.05,16.05,0,1,1-16.36,16.36c0,.11,0,.21,0,.32A16.69,16.69,0,1,0,458,284Z" transform="translate(-60.28 -64)"/><circle class="cls-3" cx="99.99" cy="255.91" r="21.16"/><path class="cls-4" d="M140.91,321.72a21.16,21.16,0,0,1,35.19-15.84,21.16,21.16,0,1,0-29.87,29.87A21.08,21.08,0,0,1,140.91,321.72Z" transform="translate(-60.28 -64)"/><path class="cls-5" d="M161.1,298.75h-.42a21.16,21.16,0,1,1-21.57,21.57c0,.14,0,.28,0,.42a22,22,0,1,0,22-22Z" transform="translate(-60.28 -64)"/><circle class="cls-3" cx="148.14" cy="178.71" r="17.73"/><path class="cls-4" d="M192.21,244.23A17.73,17.73,0,0,1,221.69,231a17.73,17.73,0,1,0-25,25A17.66,17.66,0,0,1,192.21,244.23Z" transform="translate(-60.28 -64)"/><path class="cls-5" d="M209.12,225h-.35a17.73,17.73,0,1,1-18.07,18.07c0,.12,0,.23,0,.35A18.43,18.43,0,1,0,209.12,225Z" transform="translate(-60.28 -64)"/><circle class="cls-3" cx="116.19" cy="379.25" r="11.96"/><path class="cls-4" d="M165.53,444.27a12,12,0,0,1,19.88-8.95,12,12,0,1,0-16.88,16.88A11.91,11.91,0,0,1,165.53,444.27Z" transform="translate(-60.28 -64)"/><path class="cls-5" d="M176.94,431.29h-.24a12,12,0,1,1-12.19,12.19c0,.08,0,.16,0,.24a12.43,12.43,0,1,0,12.43-12.43Z" transform="translate(-60.28 -64)"/><path class="cls-6" d="M272.28,445.59C177.43,445.59,96,388.06,61,306c-.5,5.94-.77,11.94-.77,18,0,117.08,94.92,212,212,212s212-94.92,212-212c0-6.07-.27-12.07-.77-18C448.53,388.06,367.13,445.59,272.28,445.59Z" transform="translate(-60.28 -64)"/><path class="cls-6" d="M272.28,493.84A236.24,236.24,0,0,1,65.92,372.75C87.94,466.33,172,536,272.28,536s184.33-69.67,206.36-163.25A236.24,236.24,0,0,1,272.28,493.84Z" transform="translate(-60.28 -64)"/></g><path id="X" class="cls-7" d="M494.09,140.06H425.63l-49.77,61.25L288.73,64H220.28l117,184.65L227.88,383.44h68.45l71.12-87.53L471.27,459.5h68.45L406.06,248.79Z" transform="translate(-60.28 -64)"/></g></g></svg>
\ No newline at end of file
......@@ -5,10 +5,14 @@
/** Enable dark theme */
$("#darkButton").click(function(){
if ($("body").hasClass("dark"))
$("body").removeClass("dark")
else
$("body").addClass("dark")
if ($("body").hasClass("dark")){
$("body").removeClass("dark");
$("#xcockpit_logo").attr("src","/assets/img/Logo_X-Cockpit_earth.svg");
}
else{
$("body").addClass("dark");
$("#xcockpit_logo").attr("src","/assets/img/Logo_X-Cockpit_moon.svg");
}
});
$(document).ready(function () {
......@@ -17,7 +21,8 @@ $(document).ready(function () {
var n = d.getHours();
if(n > 17 || n < 8){
$("body").addClass("dark")
$("body").addClass("dark");
$("#xcockpit_logo").attr("src","/assets/img/Logo_X-Cockpit_moon.svg");
}
});
......@@ -47,7 +52,7 @@ $(document).ready(function () {
lat = position.coords.latitude;
lon = position.coords.longitude;
api_url = 'http://api.openweathermap.org/data/2.5/weather?lat=' +
api_url = 'https://api.openweathermap.org/data/2.5/weather?lat=' +
lat + '&lon=' +
lon + '&units=metric&appid=b231606340553d9174136f7f083904b3';
// http://api.openweathermap.org/data/2.5/weather?q=London,uk&callback=test&appid=b1b15e88fa79722
......
......@@ -3,7 +3,7 @@ var express = require('express'),
router = express.Router();
var checklistController = require('../controllers/checklists');
// var resourceController = require('../controllers/tasks')
var taskController = require('../controllers/tasks');
router.route('/')
.get(checklistController.list_checklists)
......@@ -20,4 +20,12 @@ var express = require('express'),
.get(checklistController.delete_checklist);
/////////////////////////
// router.route(':id/tasks/')
// .get(taskController.list_tasks);
router.route('/:id/tasks')
.post(checklistController.add_task);
module.exports = router
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
\ No newline at end of file
pass
\ No newline at end of file
# Data generator functions
import mongodb as db
import random
import numpy
import time
import math
import string
# Source Type List => can be a API req or something retrieved from a sensor
sourceTypeList = ["API","Sensor"]
# Log Type List
logTypeList = ["pressure","temperature","cloudLevel"]
# Call DB class and init connection
print("Init DB connection")
dbConn = db.DB()
dbConn.initDBconnection()
# Fill sources table
def initSourcesTable(sourcesNameList):
if dbConn.conn.sources.count() < 10:
for name in sourcesNameList:
# print("Source name: " + name)
sourceTmp = {
'type': sourceTypeList[random.randint(0,1)],
'name': name
}
# print(sourceTmp)
dbConn.conn.sources.insert_one(sourceTmp)
else:
print("Sources already populated")
def generatorMain():
print("Starting generator main")
print("Generating pressure values")
pressureValues = numpy.random.normal(1.01325, 0.003, 1000)
print("Generating random sources")
sourcesNameList = []
for x in range(0,10):