Fix bug and DB string
This commit is contained in:
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
const EnvirementVariables = {
|
const EnvirementVariables = {
|
||||||
// node envirements
|
// node envirements
|
||||||
isDev: process.env.NODE_ENV === 'development',
|
// isDev: process.env.NODE_ENV === 'development',
|
||||||
|
isDev: true,
|
||||||
isProduction: process.env.NODE_ENV === 'production',
|
isProduction: process.env.NODE_ENV === 'production',
|
||||||
|
|
||||||
// server ports
|
// server ports
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
const { body, param, validationResult } = require('express-validator');
|
||||||
|
const { _sr } = require('../plugins/serverResponses');
|
||||||
|
const { checkValidations } = require('../plugins/controllersHelperFunctions');
|
||||||
|
const User = require('../models/User');
|
||||||
|
const Device = require('../models/GPS.Device');
|
||||||
@@ -5,13 +5,6 @@ const User = require('../models/User');
|
|||||||
const InstalledDevice = require('../models/GPS.InstalledDevice');
|
const InstalledDevice = require('../models/GPS.InstalledDevice');
|
||||||
const Device = require('../models/GPS.Device');
|
const Device = require('../models/GPS.Device');
|
||||||
|
|
||||||
/**
|
|
||||||
* get all installed device for user
|
|
||||||
* get all installed device for admin
|
|
||||||
* patch a installed device by id and type
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
module.exports.deviceRegistration = [
|
module.exports.deviceRegistration = [
|
||||||
[
|
[
|
||||||
body('IMEI').notEmpty().isString().withMessage('لطفا IMEI را وارد یا تصحیح کنید')
|
body('IMEI').notEmpty().isString().withMessage('لطفا IMEI را وارد یا تصحیح کنید')
|
||||||
|
|||||||
+2
-1
@@ -2,9 +2,10 @@
|
|||||||
const mongoose = require('mongoose')
|
const mongoose = require('mongoose')
|
||||||
// mongodb database connection string. change it as per your needs. here "mydb" is the name of the database. You don't need to create DB from mongodb terminal. mongoose create the database automatically.
|
// mongodb database connection string. change it as per your needs. here "mydb" is the name of the database. You don't need to create DB from mongodb terminal. mongoose create the database automatically.
|
||||||
const inHostUrl = 'mongodb://root:KPTt76tImNBBMm4Kor8QA9gB@asan-service:27017/asanserv_database?authSource=admin'
|
const inHostUrl = 'mongodb://root:KPTt76tImNBBMm4Kor8QA9gB@asan-service:27017/asanserv_database?authSource=admin'
|
||||||
|
const outHostUrl = 'mongodb://root:KPTt76tImNBBMm4Kor8QA9gB@hotaka.liara.cloud:33794/asanserv_database?authSource=admin'
|
||||||
const init = ()=>{
|
const init = ()=>{
|
||||||
try {
|
try {
|
||||||
mongoose.connect(inHostUrl, {
|
mongoose.connect(outHostUrl, {
|
||||||
useNewUrlParser: true,
|
useNewUrlParser: true,
|
||||||
useUnifiedTopology: true,
|
useUnifiedTopology: true,
|
||||||
useFindAndModify: false,
|
useFindAndModify: false,
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ const ScoreSchema = mongoose.Schema({
|
|||||||
},
|
},
|
||||||
profit:{
|
profit:{
|
||||||
type:Number,
|
type:Number,
|
||||||
min:0
|
min:0,
|
||||||
|
unique:true,
|
||||||
|
default:0,
|
||||||
|
required:true
|
||||||
},
|
},
|
||||||
dollarProfit:{
|
dollarProfit:{
|
||||||
type:Number,
|
type:Number,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ const complaintController = require('../controllers/complaintController')
|
|||||||
const brandController = require('../controllers/brandController')
|
const brandController = require('../controllers/brandController')
|
||||||
const requestController = require('../controllers/GPS.Request')
|
const requestController = require('../controllers/GPS.Request')
|
||||||
const withdraw = require('../controllers/GPS.Withdraw')
|
const withdraw = require('../controllers/GPS.Withdraw')
|
||||||
|
const installedDevice = require('../controllers/GPS.InstalledDevice')
|
||||||
|
|
||||||
|
|
||||||
/// //////////////////////////////////////////////////////// routes
|
/// //////////////////////////////////////////////////////// routes
|
||||||
@@ -44,7 +45,9 @@ router.patch('/gps/request/:id/:status',hasPermission('gps'), requestController.
|
|||||||
router.get('/gps/withdraw',hasPermission('gps'), withdraw.getAllForAdmin)
|
router.get('/gps/withdraw',hasPermission('gps'), withdraw.getAllForAdmin)
|
||||||
router.patch('/gps/withdraw/:id/:type',hasPermission('gps'), withdraw.updateReq)
|
router.patch('/gps/withdraw/:id/:type',hasPermission('gps'), withdraw.updateReq)
|
||||||
|
|
||||||
/// //////////////
|
/// ////////////// Installed device
|
||||||
|
router.patch('/register-device/:id/:type', installedDevice.updateInstalled)
|
||||||
|
router.get('/register-device', installedDevice.getAllForAdmin)
|
||||||
|
|
||||||
/// /////////////////////////////////////////////////////////
|
/// /////////////////////////////////////////////////////////
|
||||||
/// ///////////// survey
|
/// ///////////// survey
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ const { Router } = require('express')
|
|||||||
const router = Router()
|
const router = Router()
|
||||||
const bankAccount = require('../controllers/GPS.BankAccount')
|
const bankAccount = require('../controllers/GPS.BankAccount')
|
||||||
const withdraw = require('../controllers/GPS.Withdraw')
|
const withdraw = require('../controllers/GPS.Withdraw')
|
||||||
|
const installedDevice = require('../controllers/GPS.InstalledDevice')
|
||||||
|
|
||||||
/// ///////////////// Bank card
|
/// ///////////////// Bank card
|
||||||
router.post('/bank-card', bankAccount.addCard)
|
router.post('/bank-card', bankAccount.addCard)
|
||||||
@@ -11,5 +12,8 @@ router.delete('/bank-card/:id', bankAccount.deleteCard)
|
|||||||
router.post('/withdraw', withdraw.createRequest)
|
router.post('/withdraw', withdraw.createRequest)
|
||||||
router.get('/withdraw', withdraw.getAllForUser)
|
router.get('/withdraw', withdraw.getAllForUser)
|
||||||
|
|
||||||
|
/// //////////////// Installed device
|
||||||
|
router.post('/register-device', installedDevice.deviceRegistration)
|
||||||
|
router.get('/register-device', installedDevice.getAllForUser)
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
|
|||||||
Reference in New Issue
Block a user