mirror of
https://github.com/arnaucube/commonroutesServer.git
synced 2026-02-28 05:26:42 +01:00
moving and renaming
This commit is contained in:
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
12
README.md
Normal file → Executable file
12
README.md
Normal file → Executable file
@@ -1,9 +1,9 @@
|
|||||||
# CarsInCommonServer
|
# commonroutesServer
|
||||||
|
|
||||||
- server code: https://github.com/arnaucode/carsincommonServer
|
- server code: https://github.com/arnaucode/commonroutesServer
|
||||||
- frontend app code: https://github.com/arnaucode/carsincommonApp
|
- frontend app code: https://github.com/arnaucode/commonroutesApp
|
||||||
- images server: https://github.com/arnaucode/goImgServer
|
- images server: https://github.com/arnaucode/goImgServer
|
||||||
- admin web: https://github.com/arnaucode/carsincommonAdminWeb
|
- admin web: https://github.com/arnaucode/commonroutesAdminWeb
|
||||||
|
|
||||||
**Backend:**
|
**Backend:**
|
||||||
|
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
App:
|
App:
|
||||||
|
|
||||||

|

|
||||||
code: https://github.com/arnaucode/carsincommonApp
|
code: https://github.com/arnaucode/commonroutesApp
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
|||||||
0
adminConfig.js
Normal file → Executable file
0
adminConfig.js
Normal file → Executable file
36
controllers/adminController.js
Normal file → Executable file
36
controllers/adminController.js
Normal file → Executable file
@@ -113,6 +113,15 @@ exports.login = function(req, res) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
exports.getAllAdmins = function(req, res) {
|
||||||
|
adminModel.find()
|
||||||
|
.limit(pageSize)
|
||||||
|
.skip(pageSize * Number(req.query.page))
|
||||||
|
.exec(function(err, admins) {
|
||||||
|
if (err) return res.send(500, err.message);
|
||||||
|
res.status(200).jsonp(admins);
|
||||||
|
});
|
||||||
|
};
|
||||||
exports.changePassword = function(req, res) {
|
exports.changePassword = function(req, res) {
|
||||||
//if(req.body.)
|
//if(req.body.)
|
||||||
userModel.update({
|
userModel.update({
|
||||||
@@ -534,11 +543,24 @@ exports.validateUser = function(req, res) {
|
|||||||
user.validated = true;
|
user.validated = true;
|
||||||
user.validatedBy = admin._id;
|
user.validatedBy = admin._id;
|
||||||
|
|
||||||
|
var notification = new notificationModel({
|
||||||
|
concept: "admin",
|
||||||
|
message: "an admin has validated your account",
|
||||||
|
date: new Date(),
|
||||||
|
icon: 'admin',
|
||||||
|
link: "users/" + user._id,
|
||||||
|
user: user._id
|
||||||
|
});
|
||||||
|
notification.save(function(err, notification) {
|
||||||
|
if (err) return res.send(500, err.message);
|
||||||
|
|
||||||
|
user.notifications.push(notification._id);
|
||||||
user.save(function(err, user) {
|
user.save(function(err, user) {
|
||||||
if (err) return res.send(500, err.message);
|
if (err) return res.send(500, err.message);
|
||||||
userController.getUserById(req, res);
|
userController.getUserById(req, res);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -563,11 +585,25 @@ exports.unvalidateUser = function(req, res) {
|
|||||||
user.validated = false;
|
user.validated = false;
|
||||||
user.validatedBy = admin._id;
|
user.validatedBy = admin._id;
|
||||||
|
|
||||||
|
var notification = new notificationModel({
|
||||||
|
concept: "admin",
|
||||||
|
message: "an admin has unvalidated your account",
|
||||||
|
date: new Date(),
|
||||||
|
icon: 'admin',
|
||||||
|
link: "users/" + user._id,
|
||||||
|
user: user._id
|
||||||
|
});
|
||||||
|
notification.save(function(err, notification) {
|
||||||
|
if (err) return res.send(500, err.message);
|
||||||
|
|
||||||
|
user.notifications.push(notification._id);
|
||||||
user.save(function(err, user) {
|
user.save(function(err, user) {
|
||||||
if (err) return res.send(500, err.message);
|
if (err) return res.send(500, err.message);
|
||||||
userController.getUserById(req, res);
|
userController.getUserById(req, res);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
0
controllers/searchController.js
Normal file → Executable file
0
controllers/searchController.js
Normal file → Executable file
0
controllers/travelController.js
Normal file → Executable file
0
controllers/travelController.js
Normal file → Executable file
0
controllers/userController.js
Normal file → Executable file
0
controllers/userController.js
Normal file → Executable file
0
models/adminModel.js
Normal file → Executable file
0
models/adminModel.js
Normal file → Executable file
0
models/commentModel.js
Normal file → Executable file
0
models/commentModel.js
Normal file → Executable file
0
models/notificationModel.js
Normal file → Executable file
0
models/notificationModel.js
Normal file → Executable file
0
models/travelModel.js
Normal file → Executable file
0
models/travelModel.js
Normal file → Executable file
0
models/userModel.js
Normal file → Executable file
0
models/userModel.js
Normal file → Executable file
0
package.json
Normal file → Executable file
0
package.json
Normal file → Executable file
@@ -118,6 +118,9 @@ apiRoutes.use(function(req, res, next) {
|
|||||||
}); //fi verificació de token
|
}); //fi verificació de token
|
||||||
|
|
||||||
//admin
|
//admin
|
||||||
|
|
||||||
|
apiRoutes.route('/admins')
|
||||||
|
.get(adminCtrl.getAllAdmins);
|
||||||
apiRoutes.route('/admin/network')
|
apiRoutes.route('/admin/network')
|
||||||
.get(adminCtrl.network);
|
.get(adminCtrl.network);
|
||||||
apiRoutes.route('/admin/user/network/:userid')
|
apiRoutes.route('/admin/user/network/:userid')
|
||||||
|
|||||||
0
testSendImage.js
Normal file → Executable file
0
testSendImage.js
Normal file → Executable file
0
tests/config.json
Normal file → Executable file
0
tests/config.json
Normal file → Executable file
0
tests/main.go
Normal file → Executable file
0
tests/main.go
Normal file → Executable file
0
tests/readConfig.go
Normal file → Executable file
0
tests/readConfig.go
Normal file → Executable file
0
tests/requests.go
Normal file → Executable file
0
tests/requests.go
Normal file → Executable file
0
tests/users.json
Normal file → Executable file
0
tests/users.json
Normal file → Executable file
Reference in New Issue
Block a user