Commit 55f62775 authored by KANTAPONG SONG-NGAM's avatar KANTAPONG SONG-NGAM

add new

parent 3016b0cf
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
DashSchema = new Schema({
income : {
type : Number,
required : true
},
due : {
type : Number,
required:true
}
})
module.exports = mongoose.model('dashboard',DashSchema)
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
PaymentSchema = new Schema({
id : {
type : Number,
required : true
},
username : {
type : String,
required : true
},
payment : {
type : Number,
required : true
},
sub_id : {
type : [String],
required : true
}
})
module.exports = mongoose.model('payments', PaymentSchema)
Schema = require('mongoose').Schema
ThingSchema = new Schema({
Name : {
type : String,
required : true
},
Data : {
type : [{
Value : {
type : Number,
min : 0
},
Time : {
type : Date
}
}]
},
userId : {
type : Schema.Types.ObjectId
}
})
module.exports = mongoose.model('Things', ThingSchema)
Schema = require('mongoose').Schema var mongoose = require('mongoose');
bcrypt = require('bcrypt') var Schema = mongoose.Schema;
SALT_WORK_FACTOR = 10
UserSchema = new Schema({ UserSchema = new Schema({
id : {
type : Number,
required : true
},
username : { username : {
type : String, type : String,
required : true required : true
...@@ -10,33 +14,19 @@ UserSchema = new Schema({ ...@@ -10,33 +14,19 @@ UserSchema = new Schema({
password : { password : {
type : String, type : String,
required : true required : true
},
Email : {
type : String,
required : true
},
payment : {
type : Number,
required : true
},
sub_id : {
type : [String],
required : true
} }
}) })
UserSchema.pre('save', function(next) {
user = this
if (!user.isModified('password'))
return next()
bcrypt.genSalt(SALT_WORK_FACTOR, function(err, salt) {
if (err) return next (err)
bcrypt.hash(user.password, salt, function(err, hash) {
if (err) return next (err)
user.password = hash
next()
})
})
})
UserSchema.methods.comparePassword = function(candidate, cb) {
bcrypt.compare(candidate, this.password, function(err, isMatch) {
if (err) return cb (err)
cb(null, isMatch)
})
}
module.exports = mongoose.model('Users', UserSchema) module.exports = mongoose.model('Users', UserSchema)
module.exports = {
'secret': 'Student',
'database': 'mongodb://localhost/StdManageAPI'
}
\ No newline at end of file
mongoose = require('mongoose')
Things = require('./Things')
Users = require('./Users')
mongoose.connect('mongodb://localhost:27017/Students',{useNewUrlParser:true});
add_User = new Users({
username: 'test',
password: 'pass'
})
add_User.save(function(err) {
if (err) throw err
console.log('save USer completed.')
})
{
"name": "project",
"version": "1.0.0",
"lockfileVersion": 1
}
{
"name": "project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
express = require('express');
app = express();
bodyParser = require('body-parser');
morgan = require('morgan');
mongoose = require('mongoose');
jwt = require('jsonwebtoken');
Dashboard = require('./Dashboard');
Payments = require('./Payment');
Users = require('./Users')
config = require('./config');
port = process.env.PORT || 8000;
mongoose.connect(config.database,{useNewUrlParser:true});
// application variables
app.set('superSecret', config.secret);
// config for body-parser
app.use(bodyParser.urlencoded({ extended: false}));
app.use(bodyParser.json());
// log request
app.use(morgan('combined'));
app.get('/', function(req, res) {
res.send('wellcome to Student Management : The API is at http://localhost:' + port + '/admin');
});
//###############################USers And Admin#####################
//check user and password
app.post('/login', function(req, res) {
Users.findOne({username: req.body.username}, function(err, user) {
if (err) throw err;
if (!user) {
res.json({
success: false,
message: 'Authentication failed. User not found.'
});
return;
}
if (user.password != req.body.password) {
res.json({
success: false,
message: 'Authentication failed. Wrong password.'
});
return;
}
res.json({
success: true,
username: user.username ,
message: 'Authentication successfully finished.',
});
});
});
//############################ User ##########################################
UserRoutes = express.Router();
//####################### ดูข้อมูลส่วนตัว ##########################################
// GET(http://localhost:8000/users/profile)
UserRoutes.get('', function(req, res) {
Users.findOne({id:req.query.id}, function(err, user) {
if (err) throw err;
if(!user){
res.json({
success: false,
message: ' User not found.'
});
return;
}
res.json({name :user.username,
Email:user.Email,
Subject: user.sub_id
});
});
});
// GET(http://localhost:8000/users/profile/id)
UserRoutes.get('/:id', function(req, res) {
Users.findOne({id:req.params.id}, function(err, user) {
if (err) throw err;
if(!user){
res.json({
success: false,
message: ' User not found.'
});
return;
}
res.json({name :user.username,
Email:user.Email,
Subject: user.sub_id
});
});
});
//########################## ดูยอดค้างชำระว่ามีหนี้ไหม #######################################
// GET(http://localhost:8000/users/due)
UserRoutes.post('/due', function(req, res) {
Payments.findOne({id:req.query.id}, function(err, user) {
if (err) throw err;
if(!user){
res.json({
success: true,
message: 'WOW!!!! you not debt.'
});
return;
}
res.json(user);
});
});
// GET(http://localhost:8000/users/due/:id)
UserRoutes.post('/due/:id', function(req, res) {
Payments.findOne({id:req.params.id}, function(err, user) {
if (err) throw err;
if(!user){
res.json({
success: true,
message: 'WOW!!!! you not debt.'
});
return;
}
res.json(user);
});
});
//############################# Admin ################################################
apiRoutes = express.Router();
// GET(http://localhost:8000/admin/)
apiRoutes.get('/', function(req, res) {
res.json({ message: 'Welcome to API routing for Admin'});
});
//#############เพิ่มนักเรียนเข้าไป#################################
// POST(http://localhost:8000/admin/edituser/addition)
apiRoutes.post('/students/addition', function(req, res) {
let query ;
demo = new Users({
id:req.body.id,
username: req.body.username,
password: req.body.password,
Email: req.body.Email,
payment: req.body.payment,
sub_id: req.body.subject
});
query=demo;
payment = new Payments({
id:req.body.id,
username: req.body.username,
payment: req.body.payment,
sub_id: req.body.subject
});
// เพ่ิมเข้าเกี่ยวหนี้
Dashboard.findOne({id:0}, function(err, user) {
if (err) throw err;
user.due +=parseInt(req.body.payment,10);
// บันทึกค้างชำระเข้าไป
user.save(function(err,update){
if(err) {throw err;
}
});
});
// เพิ่มผู้ใช้งาน
demo.save(function(err) {
if (err) throw err
console.log('save data complete')
});
//เพิ่มเข้าไปในส่วนของ คนที่ยังไม่ชำระเงิน
payment.save(function(err) {
if (err) throw err
res.json({success:true,addition:query});
});
});
//############# ลบนักเรียน #################################
// POST(http://localhost:8000/admin/edituser/addition)
//delete with id ลบผู้ใช้งาน
apiRoutes.delete('/students/deletion', function(req, res){
let query = {id:req.query.id}
Users.remove(query,function(err){
if(err){
console.log(err);
}
});
Payments.remove(query,function(err){
if(err){
console.log(err);
}
});
res.json({success:'deleted success !'});
});
//############# แก้ไขนักเรียน #################################
// POST(http://localhost:8000/admin/edituser/addition)
apiRoutes.put('/students/modification', function(req, res) {
//แก้ไขในส่วนของผู้ใช้งาน
Users.findOne({id:req.body.id}, function(err, user) {
if (err) throw err;
if (!user) {
res.json({
success: false,
message: ' User not found.'
});
return;
}else {
if (req.body.username) {
user.username = req.body.username;
}
if (req.body.password) {
user.password = req.body.password;
}
if (req.body.Email) {
user.Email = req.body.Email;
}
if (req.body.payment) {
user.payment = req.body.payment;
}
if (req.body.subject) {
user.sub_id = req.body.subject;
}
user.save(function(err,update){
if(err) {throw err;
}
});
}
});
//แก้ไขในส่วนของคนค้างชำระหากยังค้างชำระ
Payments.findOne({id:req.body.id}, function(err, user) {
if (err) throw err;
if (!user) {
res.json({
success: true,
message: 'Update successfully finished.',
});
}else {
if (req.body.username) {
user.username = req.body.username;
}
if (req.body.payment) {
user.payment = req.body.payment;
}
if (req.body.subject) {
user.sub_id = req.body.subject;
}
user.save(function(err,update){
if(err) {throw err;
}else{
res.json({
success: true,
now: update ,
message: 'Update successfully finished.',
});
}
});
}
});
});
//######################### ลบผู้ใช้งาน ################################
//delete with id
apiRoutes.delete('/students/deletion/:id', function(req, res){
let query = {id:req.params.id}
Users.remove(query,function(err){
if(err){
console.log(err);
}
});
Payments.remove(query,function(err){
if(err){
console.log(err);
}
res.json({success:'deleted success !'});
});
});
//########################## ดูข้อมูลผู้ใช้งานทั้งหมด #######################################
// GET(http://localhost:8000/admin/students)
apiRoutes.get('/students', function(req, res) {
Users.find({}, function(err, user) {
if (err) throw err;
res.json(user);
});
});
//######################### ดูข้อมูลผู้ใช้งาน ตามไอดี ########################################
// GET(http://localhost:8000/admin/students/)
apiRoutes.post('/students/:id', function(req, res) {
Users.findOne({id:req.params.id}, function(err, user) {
if (err) throw err;
res.json(user);
});
});
apiRoutes.post('/students', function(req, res) {
Users.findOne({id:req.query.id}, function(err, user) {
if (err) throw err;
res.json(user);
});
});
//########################### ดูรายชื่อทั้งหมด ######################################
// GET(http://localhost:8000/admin/listuser/exhibit)
apiRoutes.get('/students/names', function(req, res) {
Users.find({}, function(err, user) {
if (err) throw err;
var str = [];
user.forEach(function(queryname){
str.push({name : queryname.username})
});
res.contentType('application/json');
res.send(JSON.stringify(str));
});
});
//################### แสดง รายได้รวม และ ยอดหนี้ค้างชำระ ###############
apiRoutes.get('/revenue', function(req, res) {
Dashboard.findOne({id:0}, function(err, user) {
if (err) throw err;
res.json(user);
});
});
//################### คนที่ค้างชำระเงิน ###############
apiRoutes.get('/payment/list', function(req, res) {
Payments.find({}, function(err, user) {
if (err) throw err;
res.json(user);
});
});
//################### ชำระเงิน ###############
apiRoutes.put('/payment', function(req, res) {
Users.findOne({id:req.body.id}, function(err, user) {
if (err) throw err;
if (!user) {
res.json({
success: false,
message: ' User not found.'
});
return;
}else {
if (req.body.payment) {
user.payment = user.payment-req.body.payment;
if(user.payment<=0){user.payment=0;}
}
user.save(function(err,update){
if(err) {throw err;
}
});
}
});
Dashboard.findOne({id:0}, function(err, user) {
if (err) throw err;
user.due -=parseInt(req.body.payment,10);
user.income +=parseInt(req.body.payment,10);
user.save(function(err,update){
if(err) {throw err;
}
});
});
Payments.findOne({id:req.body.id}, function(err, user) {
let query = {id:req.body.id}
var check = false ;
if (err) throw err;
if (!user) {
res.json({
success: false,
message: ' User not found.'
});
return;
}else {
if (req.body.payment) {
user.payment = user.payment-req.body.payment;
if(user.payment<=0){check=true;}
}
}
if(check){
Payments.remove(query,function(err){
if(err){
console.log(err);
}
res.json({success:' No debt success !'});
});
}else {
user.save(function(err,update){
if(err) {throw err;
}else{
res.json({
success: true,
now: update ,
message: 'Update successfully finished.Still has outstanding balance.',
});
}
});
}
});
});
app.use('/users',UserRoutes);
app.use('/admin', apiRoutes);
app.listen(port);
console.log('started http://localhost:' + port + '/');
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
"integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
"requires": { "requires": {
"mime-types": "~2.1.18", "mime-types": "2.1.21",
"negotiator": "0.6.1" "negotiator": "0.6.1"
} }
}, },
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
"resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz",
"integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==",
"requires": { "requires": {
"lodash": "^4.17.10" "lodash": "4.17.11"
} }
}, },
"basic-auth": { "basic-auth": {
...@@ -59,8 +59,8 @@ ...@@ -59,8 +59,8 @@
"version": "1.1.5", "version": "1.1.5",
"bundled": true, "bundled": true,
"requires": { "requires": {
"delegates": "^1.0.0", "delegates": "1.0.0",
"readable-stream": "^2.0.6" "readable-stream": "2.3.5"
} }
}, },
"balanced-match": { "balanced-match": {
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
} }
}, },
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
"version": "1.2.5", "version": "1.2.5",
"bundled": true, "bundled": true,
"requires": { "requires": {
"minipass": "^2.2.1" "minipass": "2.3.4"
} }
}, },
"fs.realpath": { "fs.realpath": {
...@@ -129,26 +129,26 @@ ...@@ -129,26 +129,26 @@
"version": "2.7.4", "version": "2.7.4",
"bundled": true, "bundled": true,
"requires": { "requires": {
"aproba": "^1.0.3", "aproba": "1.2.0",
"console-control-strings": "^1.0.0", "console-control-strings": "1.1.0",
"has-unicode": "^2.0.0", "has-unicode": "2.0.1",
"object-assign": "^4.1.0", "object-assign": "4.1.1",
"signal-exit": "^3.0.0", "signal-exit": "3.0.2",
"string-width": "^1.0.1", "string-width": "1.0.2",
"strip-ansi": "^3.0.1", "strip-ansi": "3.0.1",
"wide-align": "^1.1.0" "wide-align": "1.1.3"
} }
}, },
"glob": { "glob": {
"version": "7.1.2", "version": "7.1.2",
"bundled": true, "bundled": true,
"requires": { "requires": {
"fs.realpath": "^1.0.0", "fs.realpath": "1.0.0",
"inflight": "^1.0.4", "inflight": "1.0.6",
"inherits": "2", "inherits": "2.0.3",
"minimatch": "^3.0.4", "minimatch": "3.0.4",
"once": "^1.3.0", "once": "1.4.0",
"path-is-absolute": "^1.0.0" "path-is-absolute": "1.0.1"
} }
}, },
"has-unicode": { "has-unicode": {
...@@ -159,22 +159,22 @@ ...@@ -159,22 +159,22 @@
"version": "0.4.24", "version": "0.4.24",
"bundled": true, "bundled": true,
"requires": { "requires": {
"safer-buffer": ">= 2.1.2 < 3" "safer-buffer": "2.1.2"
} }
}, },
"ignore-walk": { "ignore-walk": {
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"requires": { "requires": {
"minimatch": "^3.0.4" "minimatch": "3.0.4"
} }
}, },
"inflight": { "inflight": {
"version": "1.0.6", "version": "1.0.6",
"bundled": true, "bundled": true,
"requires": { "requires": {
"once": "^1.3.0", "once": "1.4.0",
"wrappy": "1" "wrappy": "1.0.2"
} }
}, },
"inherits": { "inherits": {
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "1.0.1"
} }
}, },
"isarray": { "isarray": {
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "1.1.11"
} }
}, },
"minimist": { "minimist": {
...@@ -211,8 +211,8 @@ ...@@ -211,8 +211,8 @@
"version": "2.3.4", "version": "2.3.4",
"bundled": true, "bundled": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "5.1.2",
"yallist": "^3.0.0" "yallist": "3.0.2"
}, },
"dependencies": { "dependencies": {
"safe-buffer": { "safe-buffer": {
...@@ -229,7 +229,7 @@ ...@@ -229,7 +229,7 @@
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"requires": { "requires": {
"minipass": "^2.2.1" "minipass": "2.3.4"
} }
}, },
"mkdirp": { "mkdirp": {
...@@ -247,33 +247,33 @@ ...@@ -247,33 +247,33 @@
"version": "2.2.3", "version": "2.2.3",
"bundled": true, "bundled": true,
"requires": { "requires": {
"debug": "^2.1.2", "debug": "2.6.9",
"iconv-lite": "^0.4.4", "iconv-lite": "0.4.24",
"sax": "^1.2.4" "sax": "1.2.4"
} }
}, },
"node-pre-gyp": { "node-pre-gyp": {
"version": "0.11.0", "version": "0.11.0",
"bundled": true, "bundled": true,
"requires": { "requires": {
"detect-libc": "^1.0.2", "detect-libc": "1.0.3",
"mkdirp": "^0.5.1", "mkdirp": "0.5.1",
"needle": "^2.2.1", "needle": "2.2.3",
"nopt": "^4.0.1", "nopt": "4.0.1",
"npm-packlist": "^1.1.6", "npm-packlist": "1.1.11",
"npmlog": "^4.0.2", "npmlog": "4.1.2",
"rc": "^1.2.7", "rc": "1.2.8",
"rimraf": "^2.6.1", "rimraf": "2.6.2",
"semver": "^5.3.0", "semver": "5.5.1",
"tar": "^4" "tar": "4.4.6"
} }
}, },
"nopt": { "nopt": {
"version": "4.0.1", "version": "4.0.1",
"bundled": true, "bundled": true,
"requires": { "requires": {
"abbrev": "1", "abbrev": "1.1.1",
"osenv": "^0.1.4" "osenv": "0.1.5"
} }
}, },
"npm-bundled": { "npm-bundled": {
...@@ -284,18 +284,18 @@ ...@@ -284,18 +284,18 @@
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"requires": { "requires": {
"ignore-walk": "^3.0.1", "ignore-walk": "3.0.1",
"npm-bundled": "^1.0.1" "npm-bundled": "1.0.5"
} }
}, },
"npmlog": { "npmlog": {
"version": "4.1.2", "version": "4.1.2",
"bundled": true, "bundled": true,
"requires": { "requires": {
"are-we-there-yet": "~1.1.2", "are-we-there-yet": "1.1.5",
"console-control-strings": "~1.1.0", "console-control-strings": "1.1.0",
"gauge": "~2.7.3", "gauge": "2.7.4",
"set-blocking": "~2.0.0" "set-blocking": "2.0.0"
} }
}, },
"number-is-nan": { "number-is-nan": {
...@@ -310,7 +310,7 @@ ...@@ -310,7 +310,7 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1.0.2"
} }
}, },
"os-homedir": { "os-homedir": {
...@@ -325,8 +325,8 @@ ...@@ -325,8 +325,8 @@
"version": "0.1.5", "version": "0.1.5",
"bundled": true, "bundled": true,
"requires": { "requires": {
"os-homedir": "^1.0.0", "os-homedir": "1.0.2",
"os-tmpdir": "^1.0.0" "os-tmpdir": "1.0.2"
} }
}, },
"path-is-absolute": { "path-is-absolute": {
...@@ -341,10 +341,10 @@ ...@@ -341,10 +341,10 @@
"version": "1.2.8", "version": "1.2.8",
"bundled": true, "bundled": true,
"requires": { "requires": {
"deep-extend": "^0.6.0", "deep-extend": "0.6.0",
"ini": "~1.3.0", "ini": "1.3.5",
"minimist": "^1.2.0", "minimist": "1.2.0",
"strip-json-comments": "~2.0.1" "strip-json-comments": "2.0.1"
}, },
"dependencies": { "dependencies": {
"minimist": { "minimist": {
...@@ -357,20 +357,20 @@ ...@@ -357,20 +357,20 @@
"version": "2.3.5", "version": "2.3.5",
"bundled": true, "bundled": true,
"requires": { "requires": {
"core-util-is": "~1.0.0", "core-util-is": "1.0.2",
"inherits": "~2.0.3", "inherits": "2.0.3",
"isarray": "~1.0.0", "isarray": "1.0.0",
"process-nextick-args": "~2.0.0", "process-nextick-args": "2.0.0",
"safe-buffer": "~5.1.1", "safe-buffer": "5.1.1",
"string_decoder": "~1.0.3", "string_decoder": "1.0.3",
"util-deprecate": "~1.0.1" "util-deprecate": "1.0.2"
} }
}, },
"rimraf": { "rimraf": {
"version": "2.6.2", "version": "2.6.2",
"bundled": true, "bundled": true,
"requires": { "requires": {
"glob": "^7.0.5" "glob": "7.1.2"
} }
}, },
"safe-buffer": { "safe-buffer": {
...@@ -401,23 +401,23 @@ ...@@ -401,23 +401,23 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "1.1.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "1.0.0",
"strip-ansi": "^3.0.0" "strip-ansi": "3.0.1"
} }
}, },
"string_decoder": { "string_decoder": {
"version": "1.0.3", "version": "1.0.3",
"bundled": true, "bundled": true,
"requires": { "requires": {
"safe-buffer": "~5.1.0" "safe-buffer": "5.1.1"
} }
}, },
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "2.1.1"
} }
}, },
"strip-json-comments": { "strip-json-comments": {
...@@ -428,13 +428,13 @@ ...@@ -428,13 +428,13 @@
"version": "4.4.6", "version": "4.4.6",
"bundled": true, "bundled": true,
"requires": { "requires": {
"chownr": "^1.0.1", "chownr": "1.1.1",
"fs-minipass": "^1.2.5", "fs-minipass": "1.2.5",
"minipass": "^2.3.3", "minipass": "2.3.4",
"minizlib": "^1.1.0", "minizlib": "1.1.0",
"mkdirp": "^0.5.0", "mkdirp": "0.5.1",
"safe-buffer": "^5.1.2", "safe-buffer": "5.1.2",
"yallist": "^3.0.2" "yallist": "3.0.2"
}, },
"dependencies": { "dependencies": {
"safe-buffer": { "safe-buffer": {
...@@ -455,7 +455,7 @@ ...@@ -455,7 +455,7 @@
"version": "1.1.3", "version": "1.1.3",
"bundled": true, "bundled": true,
"requires": { "requires": {
"string-width": "^1.0.2 || 2" "string-width": "1.0.2"
} }
}, },
"wrappy": { "wrappy": {
...@@ -475,21 +475,21 @@ ...@@ -475,21 +475,21 @@
"integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=",
"requires": { "requires": {
"bytes": "3.0.0", "bytes": "3.0.0",
"content-type": "~1.0.4", "content-type": "1.0.4",
"debug": "2.6.9", "debug": "2.6.9",
"depd": "~1.1.2", "depd": "1.1.2",
"http-errors": "~1.6.3", "http-errors": "1.6.3",
"iconv-lite": "0.4.23", "iconv-lite": "0.4.23",
"on-finished": "~2.3.0", "on-finished": "2.3.0",
"qs": "6.5.2", "qs": "6.5.2",
"raw-body": "2.3.3", "raw-body": "2.3.3",
"type-is": "~1.6.16" "type-is": "1.6.16"
} }
}, },
"bson": { "bson": {
"version": "1.0.9", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/bson/-/bson-1.0.9.tgz", "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.0.tgz",
"integrity": "sha512-IQX9/h7WdMBIW/q/++tGd+emQr0XMdeZ6icnT/74Xk9fnabWn+gZgpE+9V+gujL3hhJOoNrnDVY7tWdzc7NUTg==" "integrity": "sha512-9Aeai9TacfNtWXOYarkFJRW2CWo+dRon+fuLZYJmvLV3+MiUp0bEI6IAZfXEIg7/Pl/7IWlLaDnhzTsD81etQA=="
}, },
"buffer-equal-constant-time": { "buffer-equal-constant-time": {
"version": "1.0.1", "version": "1.0.1",
...@@ -544,7 +544,7 @@ ...@@ -544,7 +544,7 @@
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.10.tgz", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.10.tgz",
"integrity": "sha1-HFlQAPBKiJffuFAAiSoPTDOvhsM=", "integrity": "sha1-HFlQAPBKiJffuFAAiSoPTDOvhsM=",
"requires": { "requires": {
"safe-buffer": "^5.0.1" "safe-buffer": "5.1.2"
} }
}, },
"ee-first": { "ee-first": {
...@@ -572,36 +572,36 @@ ...@@ -572,36 +572,36 @@
"resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz",
"integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==",
"requires": { "requires": {
"accepts": "~1.3.5", "accepts": "1.3.5",
"array-flatten": "1.1.1", "array-flatten": "1.1.1",
"body-parser": "1.18.3", "body-parser": "1.18.3",
"content-disposition": "0.5.2", "content-disposition": "0.5.2",
"content-type": "~1.0.4", "content-type": "1.0.4",
"cookie": "0.3.1", "cookie": "0.3.1",
"cookie-signature": "1.0.6", "cookie-signature": "1.0.6",
"debug": "2.6.9", "debug": "2.6.9",
"depd": "~1.1.2", "depd": "1.1.2",
"encodeurl": "~1.0.2", "encodeurl": "1.0.2",
"escape-html": "~1.0.3", "escape-html": "1.0.3",
"etag": "~1.8.1", "etag": "1.8.1",
"finalhandler": "1.1.1", "finalhandler": "1.1.1",
"fresh": "0.5.2", "fresh": "0.5.2",
"merge-descriptors": "1.0.1", "merge-descriptors": "1.0.1",
"methods": "~1.1.2", "methods": "1.1.2",
"on-finished": "~2.3.0", "on-finished": "2.3.0",
"parseurl": "~1.3.2", "parseurl": "1.3.2",
"path-to-regexp": "0.1.7", "path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.4", "proxy-addr": "2.0.4",
"qs": "6.5.2", "qs": "6.5.2",
"range-parser": "~1.2.0", "range-parser": "1.2.0",
"safe-buffer": "5.1.2", "safe-buffer": "5.1.2",
"send": "0.16.2", "send": "0.16.2",
"serve-static": "1.13.2", "serve-static": "1.13.2",
"setprototypeof": "1.1.0", "setprototypeof": "1.1.0",
"statuses": "~1.4.0", "statuses": "1.4.0",
"type-is": "~1.6.16", "type-is": "1.6.16",
"utils-merge": "1.0.1", "utils-merge": "1.0.1",
"vary": "~1.1.2" "vary": "1.1.2"
}, },
"dependencies": { "dependencies": {
"statuses": { "statuses": {
...@@ -617,12 +617,12 @@ ...@@ -617,12 +617,12 @@
"integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
"requires": { "requires": {
"debug": "2.6.9", "debug": "2.6.9",
"encodeurl": "~1.0.2", "encodeurl": "1.0.2",
"escape-html": "~1.0.3", "escape-html": "1.0.3",
"on-finished": "~2.3.0", "on-finished": "2.3.0",
"parseurl": "~1.3.2", "parseurl": "1.3.2",
"statuses": "~1.4.0", "statuses": "1.4.0",
"unpipe": "~1.0.0" "unpipe": "1.0.0"
}, },
"dependencies": { "dependencies": {
"statuses": { "statuses": {
...@@ -647,10 +647,10 @@ ...@@ -647,10 +647,10 @@
"resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
"requires": { "requires": {
"depd": "~1.1.2", "depd": "1.1.2",
"inherits": "2.0.3", "inherits": "2.0.3",
"setprototypeof": "1.1.0", "setprototypeof": "1.1.0",
"statuses": ">= 1.4.0 < 2" "statuses": "1.5.0"
} }
}, },
"iconv-lite": { "iconv-lite": {
...@@ -658,7 +658,7 @@ ...@@ -658,7 +658,7 @@
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
"requires": { "requires": {
"safer-buffer": ">= 2.1.2 < 3" "safer-buffer": "2.1.2"
} }
}, },
"inherits": { "inherits": {
...@@ -676,15 +676,15 @@ ...@@ -676,15 +676,15 @@
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.3.0.tgz", "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.3.0.tgz",
"integrity": "sha512-oge/hvlmeJCH+iIz1DwcO7vKPkNGJHhgkspk8OH3VKlw+mbi42WtD4ig1+VXRln765vxptAv+xT26Fd3cteqag==", "integrity": "sha512-oge/hvlmeJCH+iIz1DwcO7vKPkNGJHhgkspk8OH3VKlw+mbi42WtD4ig1+VXRln765vxptAv+xT26Fd3cteqag==",
"requires": { "requires": {
"jws": "^3.1.5", "jws": "3.1.5",
"lodash.includes": "^4.3.0", "lodash.includes": "4.3.0",
"lodash.isboolean": "^3.0.3", "lodash.isboolean": "3.0.3",
"lodash.isinteger": "^4.0.4", "lodash.isinteger": "4.0.4",
"lodash.isnumber": "^3.0.3", "lodash.isnumber": "3.0.3",
"lodash.isplainobject": "^4.0.6", "lodash.isplainobject": "4.0.6",
"lodash.isstring": "^4.0.1", "lodash.isstring": "4.0.1",
"lodash.once": "^4.0.0", "lodash.once": "4.1.1",
"ms": "^2.1.1" "ms": "2.1.1"
}, },
"dependencies": { "dependencies": {
"ms": { "ms": {
...@@ -701,7 +701,7 @@ ...@@ -701,7 +701,7 @@
"requires": { "requires": {
"buffer-equal-constant-time": "1.0.1", "buffer-equal-constant-time": "1.0.1",
"ecdsa-sig-formatter": "1.0.10", "ecdsa-sig-formatter": "1.0.10",
"safe-buffer": "^5.0.1" "safe-buffer": "5.1.2"
} }
}, },
"jws": { "jws": {
...@@ -709,8 +709,8 @@ ...@@ -709,8 +709,8 @@
"resolved": "https://registry.npmjs.org/jws/-/jws-3.1.5.tgz", "resolved": "https://registry.npmjs.org/jws/-/jws-3.1.5.tgz",
"integrity": "sha512-GsCSexFADNQUr8T5HPJvayTjvPIfoyJPtLQBwn5a4WZQchcrPMPMAWcC1AzJVRDKyD6ZPROPAxgv6rfHViO4uQ==", "integrity": "sha512-GsCSexFADNQUr8T5HPJvayTjvPIfoyJPtLQBwn5a4WZQchcrPMPMAWcC1AzJVRDKyD6ZPROPAxgv6rfHViO4uQ==",
"requires": { "requires": {
"jwa": "^1.1.5", "jwa": "1.1.6",
"safe-buffer": "^5.0.1" "safe-buffer": "5.1.2"
} }
}, },
"kareem": { "kareem": {
...@@ -799,47 +799,40 @@ ...@@ -799,47 +799,40 @@
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz",
"integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==",
"requires": { "requires": {
"mime-db": "~1.37.0" "mime-db": "1.37.0"
} }
}, },
"mongodb": { "mongodb": {
"version": "3.1.6", "version": "3.1.8",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.1.6.tgz", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.1.8.tgz",
"integrity": "sha512-E5QJuXQoMlT7KyCYqNNMfAkhfQD79AT4F8Xd+6x37OX+8BL17GyXyWvfm6wuyx4wnzCCPoCSLeMeUN2S7dU9yw==", "integrity": "sha512-yNKwYxQ6m00NV6+pMoWoheFTHSQVv1KkSrfOhRDYMILGWDYtUtQRqHrFqU75rmPIY8hMozVft8zdC4KYMWaM3Q==",
"requires": { "requires": {
"mongodb-core": "3.1.5", "mongodb-core": "3.1.7",
"safe-buffer": "^5.1.2" "safe-buffer": "5.1.2"
} }
}, },
"mongodb-core": { "mongodb-core": {
"version": "3.1.5", "version": "3.1.7",
"resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.1.5.tgz", "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.1.7.tgz",
"integrity": "sha512-emT/tM4ZBinqd6RZok+EzDdtN4LjYJIckv71qQVOEFmvXgT5cperZegVmTgox/1cx4XQu6LJ5ZuIwipP/eKdQg==", "integrity": "sha512-YffpSrLmgFNmrvkGx+yX00KyBNk64C0BalfEn6vHHkXtcMUGXw8nxrMmhq5eXPLLlYeBpD/CsgNxE2Chf0o4zQ==",
"requires": { "requires": {
"bson": "^1.1.0", "bson": "1.1.0",
"require_optional": "^1.0.1", "require_optional": "1.0.1",
"safe-buffer": "^5.1.2", "safe-buffer": "5.1.2",
"saslprep": "^1.0.0" "saslprep": "1.0.2"
},
"dependencies": {
"bson": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/bson/-/bson-1.1.0.tgz",
"integrity": "sha512-9Aeai9TacfNtWXOYarkFJRW2CWo+dRon+fuLZYJmvLV3+MiUp0bEI6IAZfXEIg7/Pl/7IWlLaDnhzTsD81etQA=="
}
} }
}, },
"mongoose": { "mongoose": {
"version": "5.3.7", "version": "5.3.11",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.3.7.tgz", "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.3.11.tgz",
"integrity": "sha512-az9DtkYDuZFRpCa8aCnGHQP/up/P0fku8omtYxVwBAlQElO/yCJpKpIAR91szRbua6k9WNGpNde4KjdbA79Spg==", "integrity": "sha512-LrsatxtUfZAerAxyFiaw/8T8M4T9Ff9+6wFkJwfTVDz9skX+HVOs70QOzTDawz0k0Q0I6qt9xv/ZYQi2Paykgw==",
"requires": { "requires": {
"async": "2.6.1", "async": "2.6.1",
"bson": "~1.0.5", "bson": "1.1.0",
"kareem": "2.3.0", "kareem": "2.3.0",
"lodash.get": "4.4.2", "lodash.get": "4.4.2",
"mongodb": "3.1.6", "mongodb": "3.1.8",
"mongodb-core": "3.1.5", "mongodb-core": "3.1.7",
"mongoose-legacy-pluralize": "1.0.2", "mongoose-legacy-pluralize": "1.0.2",
"mpath": "0.5.1", "mpath": "0.5.1",
"mquery": "3.2.0", "mquery": "3.2.0",
...@@ -859,11 +852,11 @@ ...@@ -859,11 +852,11 @@
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz", "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz",
"integrity": "sha512-HQStPIV4y3afTiCYVxirakhlCfGkI161c76kKFca7Fk1JusM//Qeo1ej2XaMniiNeaZklMVrh3vTtIzpzwbpmA==", "integrity": "sha512-HQStPIV4y3afTiCYVxirakhlCfGkI161c76kKFca7Fk1JusM//Qeo1ej2XaMniiNeaZklMVrh3vTtIzpzwbpmA==",
"requires": { "requires": {
"basic-auth": "~2.0.0", "basic-auth": "2.0.1",
"debug": "2.6.9", "debug": "2.6.9",
"depd": "~1.1.2", "depd": "1.1.2",
"on-finished": "~2.3.0", "on-finished": "2.3.0",
"on-headers": "~1.0.1" "on-headers": "1.0.1"
} }
}, },
"mpath": { "mpath": {
...@@ -931,7 +924,7 @@ ...@@ -931,7 +924,7 @@
"resolved": "https://registry.npmjs.org/passport/-/passport-0.4.0.tgz", "resolved": "https://registry.npmjs.org/passport/-/passport-0.4.0.tgz",
"integrity": "sha1-xQlWkTR71a07XhgCOMORTRbwWBE=", "integrity": "sha1-xQlWkTR71a07XhgCOMORTRbwWBE=",
"requires": { "requires": {
"passport-strategy": "1.x.x", "passport-strategy": "1.0.0",
"pause": "0.0.1" "pause": "0.0.1"
} }
}, },
...@@ -940,8 +933,8 @@ ...@@ -940,8 +933,8 @@
"resolved": "http://registry.npmjs.org/passport-jwt/-/passport-jwt-4.0.0.tgz", "resolved": "http://registry.npmjs.org/passport-jwt/-/passport-jwt-4.0.0.tgz",
"integrity": "sha512-BwC0n2GP/1hMVjR4QpnvqA61TxenUMlmfNjYNgK0ZAs0HK4SOQkHcSv4L328blNTLtHq7DbmvyNJiH+bn6C5Mg==", "integrity": "sha512-BwC0n2GP/1hMVjR4QpnvqA61TxenUMlmfNjYNgK0ZAs0HK4SOQkHcSv4L328blNTLtHq7DbmvyNJiH+bn6C5Mg==",
"requires": { "requires": {
"jsonwebtoken": "^8.2.0", "jsonwebtoken": "8.3.0",
"passport-strategy": "^1.0.0" "passport-strategy": "1.0.0"
} }
}, },
"passport-local": { "passport-local": {
...@@ -949,7 +942,7 @@ ...@@ -949,7 +942,7 @@
"resolved": "https://registry.npmjs.org/passport-local/-/passport-local-1.0.0.tgz", "resolved": "https://registry.npmjs.org/passport-local/-/passport-local-1.0.0.tgz",
"integrity": "sha1-H+YyaMkudWBmJkN+O5BmYsFbpu4=", "integrity": "sha1-H+YyaMkudWBmJkN+O5BmYsFbpu4=",
"requires": { "requires": {
"passport-strategy": "1.x.x" "passport-strategy": "1.0.0"
} }
}, },
"passport-strategy": { "passport-strategy": {
...@@ -972,7 +965,7 @@ ...@@ -972,7 +965,7 @@
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz",
"integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==",
"requires": { "requires": {
"forwarded": "~0.1.2", "forwarded": "0.1.2",
"ipaddr.js": "1.8.0" "ipaddr.js": "1.8.0"
} }
}, },
...@@ -1007,8 +1000,8 @@ ...@@ -1007,8 +1000,8 @@
"resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz",
"integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==",
"requires": { "requires": {
"resolve-from": "^2.0.0", "resolve-from": "2.0.0",
"semver": "^5.1.0" "semver": "5.6.0"
} }
}, },
"resolve-from": { "resolve-from": {
...@@ -1032,7 +1025,7 @@ ...@@ -1032,7 +1025,7 @@
"integrity": "sha512-4cDsYuAjXssUSjxHKRe4DTZC0agDwsCqcMqtJAQPzC74nJ7LfAJflAtC1Zed5hMzEQKj82d3tuzqdGNRsLJ4Gw==", "integrity": "sha512-4cDsYuAjXssUSjxHKRe4DTZC0agDwsCqcMqtJAQPzC74nJ7LfAJflAtC1Zed5hMzEQKj82d3tuzqdGNRsLJ4Gw==",
"optional": true, "optional": true,
"requires": { "requires": {
"sparse-bitfield": "^3.0.3" "sparse-bitfield": "3.0.3"
} }
}, },
"semver": { "semver": {
...@@ -1046,18 +1039,18 @@ ...@@ -1046,18 +1039,18 @@
"integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==",
"requires": { "requires": {
"debug": "2.6.9", "debug": "2.6.9",
"depd": "~1.1.2", "depd": "1.1.2",
"destroy": "~1.0.4", "destroy": "1.0.4",
"encodeurl": "~1.0.2", "encodeurl": "1.0.2",
"escape-html": "~1.0.3", "escape-html": "1.0.3",
"etag": "~1.8.1", "etag": "1.8.1",
"fresh": "0.5.2", "fresh": "0.5.2",
"http-errors": "~1.6.2", "http-errors": "1.6.3",
"mime": "1.4.1", "mime": "1.4.1",
"ms": "2.0.0", "ms": "2.0.0",
"on-finished": "~2.3.0", "on-finished": "2.3.0",
"range-parser": "~1.2.0", "range-parser": "1.2.0",
"statuses": "~1.4.0" "statuses": "1.4.0"
}, },
"dependencies": { "dependencies": {
"statuses": { "statuses": {
...@@ -1072,9 +1065,9 @@ ...@@ -1072,9 +1065,9 @@
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz",
"integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==",
"requires": { "requires": {
"encodeurl": "~1.0.2", "encodeurl": "1.0.2",
"escape-html": "~1.0.3", "escape-html": "1.0.3",
"parseurl": "~1.3.2", "parseurl": "1.3.2",
"send": "0.16.2" "send": "0.16.2"
} }
}, },
...@@ -1094,7 +1087,7 @@ ...@@ -1094,7 +1087,7 @@
"integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=", "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=",
"optional": true, "optional": true,
"requires": { "requires": {
"memory-pager": "^1.0.2" "memory-pager": "1.1.0"
} }
}, },
"statuses": { "statuses": {
...@@ -1108,7 +1101,7 @@ ...@@ -1108,7 +1101,7 @@
"integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==",
"requires": { "requires": {
"media-typer": "0.3.0", "media-typer": "0.3.0",
"mime-types": "~2.1.18" "mime-types": "2.1.21"
} }
}, },
"unpipe": { "unpipe": {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"body-parser": "^1.18.3", "body-parser": "^1.18.3",
"express": "^4.16.4", "express": "^4.16.4",
"jsonwebtoken": "^8.3.0", "jsonwebtoken": "^8.3.0",
"mongoose": "^5.3.7", "mongoose": "^5.3.11",
"morgan": "^1.9.1", "morgan": "^1.9.1",
"passport": "^0.4.0", "passport": "^0.4.0",
"passport-jwt": "^4.0.0", "passport-jwt": "^4.0.0",
......
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
DashSchema = new Schema({
income : {
type : Number,
required : true
}
})
module.exports = mongoose.model('Dashboard',DashSchema)
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
PaymentSchema = new Schema({
id : {
type : Number,
required : true
},
username : {
type : String,
required : true
},
payment : {
type : Number,
required : true
},
sub_id : {
type : [String],
required : true
}
})
module.exports = mongoose.model('payments', PaymentSchema)
...@@ -2,11 +2,12 @@ mongoose = require('mongoose') ...@@ -2,11 +2,12 @@ mongoose = require('mongoose')
Things = require('./Things') Things = require('./Things')
Users = require('./Users') Users = require('./Users')
mongoose.connect('mongodb://localhost:27017/TestAPI',{useNewUrlParser:true}); mongoose.connect('mongodb://localhost:27017/StdManageAPI',{useNewUrlParser:true});
testUser = new Users({ testUser = new Users({
username: 'test', username: 'Admin',
password: 'pass' password: '1234',
admin:true
}) })
testUser.save(function(err) { testUser.save(function(err) {
......
module.exports = { module.exports = {
'secret': 'KolenCompation', 'secret': 'KolenCompation',
'database': 'mongodb://localhost/Kolen' 'database': 'mongodb://localhost/StdManageAPI'
} }
\ No newline at end of file
...@@ -36,8 +36,8 @@ app.get('/', function(req, res) { ...@@ -36,8 +36,8 @@ app.get('/', function(req, res) {
app.get('/setup', function(req, res) { app.get('/setup', function(req, res) {
demo = new User({ demo = new User({
username: 'demouser', username: 'admin',
password: 'password', // TODO: encrypt password with bcrypt password: '1234', // TODO: encrypt password with bcrypt
admin: true admin: true
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment