Best JavaScript code snippet using devicefarmer-stf
main.js
Source:main.js
...20 controller: 'landingPageAuctionsController',21 resolve: {22 isLoggedIn: function(auth,$state,$q,$location ) {23 var deferred =$q.defer();24 var isUser = auth.getUserInfo();25 console.log("Is user",isUser);26 if( !isUser){27 console.log("getUserInfo", auth.getUserInfo());28 deferred.resolve(auth.getUserInfo());29 }30 else {31 console.log("I am in the error");32 //33 deferred.reject({authenticated:true});34 }35 return deferred.promise;36 }37 }38 })39 .state('auctionableListings', {40 url:'/auctionableListings',41 templateUrl: '/auctionableListings/auctionableListings.html',42 controller: 'auctionableListingsController',43 resolve: {44 data: function ($http) {45 return $http({46 method : "POST",47 url: '/getAuctionableProperties',48 data: {49 "dstcity": localStorage.auctionCity50 }51 }).then(function (response) {52 return response.data;53 });54 }55 }56 // params : { listings : null}57 })58 .state('individualAuctionableListing', {59 url:'/individualAuctionableListing',60 templateUrl: '/auctionableListings/individualAuctionableListing.html',61 controller: 'individualAuctionableListingController',62 params : { "listing" : null}63 })64 .state('individualListing', {65 url:'/individualListing',66 templateUrl: '/individualListing/individualListing.html',67 controller: 'individualListingController',68 params : { "listing" : null},69 resolve: {70 isLoggedIn: function(auth,$state,$q ) {71 var deferred =$q.defer();72 var isUser = auth.getUserInfo();73 console.log("Is user",isUser);74 if( isUser.data.user){75 console.log("getUserInfo", auth.getUserInfo());76 deferred.resolve(auth.getUserInfo());77 }78 else {79 console.log("I am in the error");80 deferred.reject({ authenticated: false });81 }82 return deferred.promise;83 }84 }85 })86 .state('bookTrip', {87 url:'/bookTrip',88 templateUrl: '/trips/bookTrip.html',89 controller: 'bookTripController',90 params : { "listing" : null, "checkInDate" : null, "checkOutDate" : null, "guestsSelected" : null},91 resolve: {92 isLoggedIn: function(auth,$state,$q ) {93 var deferred =$q.defer();94 var isUser = auth.getUserInfo();95 console.log("Is user",isUser);96 if( isUser.data.user){97 console.log("getUserInfo", auth.getUserInfo());98 deferred.resolve(auth.getUserInfo());99 }100 else {101 console.log("I am in the error");102 deferred.reject({ authenticated: false });103 }104 return deferred.promise;105 }106 }107 })108 .state('showalllistings', {109 url:'/showlistings',110 templateUrl: '/showlistings/showalllistings.html',111 controller: 'showalllistingsController',112 resolve: {113 data: function ($http) {114 return $http({115 method : "POST",116 url: '/getProperties',117 data: {118 "dstcity": localStorage.dstcity1119 }120 }).then(function (response) {121 return response.data;122 });123 },124 isLoggedIn: function(auth,$state,$q ) {125 var deferred =$q.defer();126 var isUser = auth.getUserInfo();127 console.log("Is user",isUser);128 if( isUser.data.user){129 console.log("getUserInfo", auth.getUserInfo());130 deferred.resolve(auth.getUserInfo());131 }132 else {133 console.log("I am in the error");134 deferred.reject({ authenticated: false });135 }136 return deferred.promise;137 }138 }139 })140 .state('yourTrips', {141 url:'/yourtrips',142 templateUrl: '/trips/yourtrips.html',143 controller: 'yourTripsController',144 onEnter: function(userTrack){145 console.log('about to enter the the yourTrips'+userTrack);146 userTrack.addChild('yourTrips', Date.now());147 },148 resolve: {149 isLoggedIn: function(auth,$state,$q ) {150 var deferred =$q.defer();151 var isUser = auth.getUserInfo();152 console.log("Is user",isUser);153 if( isUser.data.user){154 console.log("getUserInfo", auth.getUserInfo());155 deferred.resolve(auth.getUserInfo());156 }157 else {158 console.log("I am in the error");159 deferred.reject({ authenticated: false });160 }161 return deferred.promise;162 }163 }164 })165 .state('dashboard',{166 url:'/dashboard',167 //params : { useremail : null},168 templateUrl:'/dashboard/dashboard.html',169 //controller : 'successLoginController',170 })171 .state('editProfile',{172 url:'/editProfile',173 templateUrl:'/editProfile/editProfile.html',174 controller : 'editProfileController',175 resolve: {176 isLoggedIn: function($http) {177 return $http.get('/isLoggedIn').success(function(response){178 return response;179 }).error(function(err){180 console.log(err);181 })182 }183 }184 })185 .state('viewProfile',{186 url:'/viewProfile',187 templateUrl:'/editProfile/viewProfile.html',188 controller : 'viewProfileController',189 resolve: {190 isLoggedIn: function(auth,$state,$q ) {191 var deferred =$q.defer();192 var isUser = auth.getUserInfo();193 console.log("Is user",isUser);194 if( isUser.data.user){195 console.log("getUserInfo", auth.getUserInfo());196 deferred.resolve(auth.getUserInfo());197 }198 else {199 console.log("I am in the error");200 deferred.reject({ authenticated: false });201 }202 return deferred.promise;203 }204 }205 })206 .state('editPhotoAndVideo',{207 url:'/editPhotoAndVideo',208 templateUrl:'/editProfile/editPhotoAndVideo.html',209 controller : 'editPhotoAndVideoController',210 resolve: {211 isLoggedIn: function($http) {212 return $http.get('/isLoggedIn').success(function(response){213 return response;214 }).error(function(err){215 console.log(err);216 })217 }218 }219 })220 .state('yourListings',{221 url:'/yourListings',222 //params : { useremail : null},223 templateUrl:'/yourListings/yourListings.html',224 controller : 'yourListingsController',225 resolve: {226 isLoggedIn: function(auth,$state,$q ) {227 var deferred =$q.defer();228 var isUser = auth.getUserInfo();229 console.log("Is user",isUser);230 if( isUser.data.user){231 console.log("getUserInfo", auth.getUserInfo());232 deferred.resolve(auth.getUserInfo());233 }234 else {235 console.log("I am in the error");236 deferred.reject({ authenticated: false });237 }238 return deferred.promise;239 }240 }241 })242 243 .state('manageListings',{244 url:'/manageListings',245 //params : { useremail : null},246 templateUrl:'/yourListings/manageListings.html',247 controller : 'yourListingsController',248 resolve: {249 isLoggedIn: function(auth,$state,$q ) {250 var deferred =$q.defer();251 var isUser = auth.getUserInfo();252 console.log("Is user",isUser);253 if( isUser.data.user){254 console.log("getUserInfo", auth.getUserInfo());255 deferred.resolve(auth.getUserInfo());256 }257 else {258 console.log("I am in the error");259 deferred.reject({ authenticated: false });260 }261 return deferred.promise;262 }263 }264 })265 266 .state('accountSettings',{267 url:'/accountSettings',268 //params : { useremail : null},269 templateUrl:'/accountSettings/accountSettings.html',270 controller : 'accountSettingsController',271 resolve: {272 isLoggedIn: function($http) {273 return $http.get('/isLoggedIn').success(function(response){274 return response;275 }).error(function(err){276 console.log(err);277 })278 }279 }280 })281 .state('transactionHistory',{282 url:'/transactionHistory',283 //params : { useremail : null},284 templateUrl:'/accountSettings/transactionHistory.html',285 controller : 'transactionHistoryController',286 resolve: {287 isLoggedIn: function($http) {288 return $http.get('/isLoggedIn').success(function(response){289 return response;290 }).error(function(err){291 console.log(err);292 })293 }294 }295 })296 $stateProvider.state('landingPage',{297 url:'/',298 templateUrl: "host/landingPage.html",299 controller :"landingPage",300 resolve: {301 isLoggedIn: function(auth,$state,$q,$location ) {302 var deferred =$q.defer();303 var isUser = auth.getUserInfo();304 console.log("Is user",isUser);305 if( !isUser){306 console.log("getUserInfo", auth.getUserInfo());307 deferred.resolve(auth.getUserInfo());308 }309 else {310 console.log("I am in the error");311 //312 deferred.reject({authenticated:true});313 }314 return deferred.promise;315 }316 }317 }).318 state('landingPage.afterSignIn',{319 url:'/profile',320 templateUrl: "host/afterSignIn.html",321 controller :"afterSignIn",322 resolve: {323 isLoggedIn: function(auth,$state,$q ) {324 var deferred =$q.defer();325 var isUser = auth.getUserInfo();326 console.log("Is user",isUser);327 if( isUser.data.user){328 console.log("getUserInfo", auth.getUserInfo());329 deferred.resolve(auth.getUserInfo());330 }331 else {332 console.log("I am in the error");333 deferred.reject({ authenticated: false });334 }335 return deferred.promise;336 }337 }338 }).339 state('host.login',{340 url:'/login',341 templateUrl: "host/login.html",342 controller :"login"343 }).state('host.signup',{344 url:'/signup',345 templateUrl: "host/signup.html",346 controller :"signup"347 }).state('host.presignup',{348 url:'/signup-options',349 templateUrl: "host/presignup.html",350 controller :"presignup"351 })352 .state('host',{353 url:'/host',354 templateUrl: "host/host.html",355 controller :"hostController"356 })357 .state('userHome',{358 url:'/userHome',359 templateUrl: "host/userHome.html",360 controller :"userHome",361 resolve: {362 isLoggedIn: function(auth,$state,$q ) {363 var deferred =$q.defer();364 var isUser = auth.getUserInfo();365 console.log("Is user",isUser);366 if( isUser.data.user){367 console.log("getUserInfo", auth.getUserInfo());368 deferred.resolve(auth.getUserInfo());369 }370 else {371 console.log("I am in the error");372 deferred.reject({ authenticated: false });373 }374 return deferred.promise;375 }376 }377 })378 .state('hostingSteps',{379 url:'/hostingSteps',380 templateUrl: "host/hostingSteps.html",381 controller :"hostingStepsController",382 params:{user:null},383 onEnter: function(userTrack){384 console.log('about to enter the the hostDashBoards'+userTrack);385 userTrack.addChild('hostingSteps', Date.now());386 },387 resolve: {388 isLoggedIn: function(auth,$state,$q ) {389 var deferred =$q.defer();390 var isUser = auth.getUserInfo();391 console.log("Is user",isUser);392 if( isUser.data.user){393 console.log("getUserInfo", auth.getUserInfo());394 deferred.resolve(auth.getUserInfo());395 }396 else {397 console.log("I am in the error");398 deferred.reject({ authenticated: false });399 }400 return deferred.promise;401 }402 }403 })404 .state('hostDashboard',{405 url:'/hostDashboard',406 templateUrl: "host/hostDashboard.html",407 controller :"hostDashboard",408 params:{user:null},409 onEnter: function(userTrack){410 console.log('about to enter the the hostDashBoards'+userTrack);411 userTrack.addChild('hostDashboard', Date.now());412 },413 resolve: {414 isLoggedIn: function(auth,$state,$q ) {415 var deferred =$q.defer();416 var isUser = auth.getUserInfo();417 console.log("Is user",isUser);418 if( isUser.data.user){419 console.log("getUserInfo", auth.getUserInfo());420 deferred.resolve(auth.getUserInfo());421 }422 else {423 console.log("I am in the error");424 deferred.reject({ authenticated: false });425 }426 return deferred.promise;427 }428 }429 })430 .state('hostingSteps.step1',{431 url:'/step1',432 templateUrl: "host/hostingStep1.html",433 controller :"hostingStepsController",434 params:{place:null,user:null},435 resolve: {436 isLoggedIn: function(auth,$state,$q ) {437 var deferred =$q.defer();438 var isUser = auth.getUserInfo();439 console.log("Is user",isUser);440 if( isUser.data.user){441 console.log("getUserInfo", auth.getUserInfo());442 deferred.resolve(auth.getUserInfo());443 }444 else {445 console.log("I am in the error");446 deferred.reject({ authenticated: false });447 }448 return deferred.promise;449 }450 }451 })452 .state('pendingRequest',{453 url:'/pendingRequest',454 templateUrl: "host/pendingRequest.html",455 controller :"pendingRequest",456 params:{place:null,user:null},457 resolve: {458 isLoggedIn: function(auth,$state,$q ) {459 var deferred =$q.defer();460 var isUser = auth.getUserInfo();461 console.log("Is user",isUser);462 if( isUser.data.user){463 console.log("getUserInfo", auth.getUserInfo());464 deferred.resolve(auth.getUserInfo());465 }466 else {467 console.log("I am in the error");468 deferred.reject({ authenticated: false });469 }470 return deferred.promise;471 }472 }473 })474 .state('yourReservations',{475 url:'/yourReservations',476 templateUrl: "host/yourReservations.html",477 controller :"yourReservations",478 params:{place:null,user:null},479 resolve: {480 isLoggedIn: function(auth,$state,$q ) {481 var deferred =$q.defer();482 var isUser = auth.getUserInfo();483 console.log("Is user",isUser);484 if( isUser.data.user){485 console.log("getUserInfo", auth.getUserInfo());486 deferred.resolve(auth.getUserInfo());487 }488 else {489 console.log("I am in the error");490 deferred.reject({ authenticated: false });491 }492 return deferred.promise;493 }494 }495 })496 .state('myReviews',{497 url:'/myReviews',498 templateUrl: "host/myReviews.html",499 controller :"myReviews",500 params:{place:null,user:null},501 resolve: {502 isLoggedIn: function(auth,$state,$q ) {503 var deferred =$q.defer();504 var isUser = auth.getUserInfo();505 console.log("Is user",isUser);506 if( isUser.data.user){507 console.log("getUserInfo", auth.getUserInfo());508 deferred.resolve(auth.getUserInfo());509 }510 else {511 console.log("I am in the error");512 deferred.reject({ authenticated: false });513 }514 return deferred.promise;515 }516 }517 })518 .state('hostingSteps.location',{519 url:'/location',520 templateUrl: "host/location.html",521 controller :"hostingStepLocationController",522 params:{place:null}523 // resolve: function(auth,$state,$q ) {524 //525 // var deferred =$q.defer();526 // var isUser = auth.getUserInfo();527 // console.log("Is user",isUser);528 // if( isUser.data.user){529 //530 // console.log("getUserInfo", auth.getUserInfo());531 // deferred.resolve(auth.getUserInfo());532 // }533 // else {534 // console.log("I am in the error");535 // deferred.reject({ authenticated: false });536 //537 // }538 // return deferred.promise;539 //540 // }541 })542 .state('hostingSteps.amneties',{543 url:'/amneties',544 templateUrl: "host/amneties.html",545 controller :"hostingAmnetiesController",546 params:{place:null},547 // resolve: function(auth,$state,$q ) {548 //549 // var deferred =$q.defer();550 // var isUser = auth.getUserInfo();551 // console.log("Is user",isUser);552 // if( isUser.data.user){553 //554 // console.log("getUserInfo", auth.getUserInfo());555 // deferred.resolve(auth.getUserInfo());556 // }557 // else {558 // console.log("I am in the error");559 // deferred.reject({ authenticated: false });560 //561 // }562 // return deferred.promise;563 //564 // }565 })566 .state('hostingSteps.spaces',{567 url:'/spaces',568 templateUrl: "host/spaces.html",569 controller :"hostingSpacesController",570 params:{place:null}571 // resolve: function(auth,$state,$q ) {572 //573 // var deferred =$q.defer();574 // var isUser = auth.getUserInfo();575 // console.log("Is user",isUser);576 // if( isUser.data.user){577 //578 // console.log("getUserInfo", auth.getUserInfo());579 // deferred.resolve(auth.getUserInfo());580 // }581 // else {582 // console.log("I am in the error");583 // deferred.reject({ authenticated: false });584 //585 // }586 // return deferred.promise;587 //588 // }589 })590 .state('hostingSteps.description',{591 url:'/description',592 templateUrl: "host/description.html",593 controller :"hostingDescriptionController",594 params:{place:null}595 // resolve: function(auth,$state,$q ) {596 //597 // var deferred =$q.defer();598 // var isUser = auth.getUserInfo();599 // console.log("Is user",isUser);600 // if( isUser.data.user){601 //602 // console.log("getUserInfo", auth.getUserInfo());603 // deferred.resolve(auth.getUserInfo());604 // }605 // else {606 // console.log("I am in the error");607 // deferred.reject({ authenticated: false });608 //609 // }610 // return deferred.promise;611 //612 // }613 })614 .state('hostingSteps.price',{615 url:'/price',616 templateUrl: "host/price.html",617 controller :"hostingPriceController",618 params:{place:null}619 // resolve: function(auth,$state,$q ) {620 //621 // var deferred =$q.defer();622 // var isUser = auth.getUserInfo();623 // console.log("Is user",isUser);624 // if( isUser.data.user){625 //626 // console.log("getUserInfo", auth.getUserInfo());627 // deferred.resolve(auth.getUserInfo());628 // }629 // else {630 // console.log("I am in the error");631 // deferred.reject({ authenticated: false });632 //633 // }634 // return deferred.promise;635 //636 // }637 })638 .state('hostingSteps.upload',{639 url:'/upload',640 templateUrl: "host/upload.html",641 controller :"hostingUploadController",642 params:{listId:null}643 // resolve: function(auth,$state,$q ) {644 //645 // var deferred =$q.defer();646 // var isUser = auth.getUserInfo();647 // console.log("Is user",isUser);648 // if( isUser.data.user){649 //650 // console.log("getUserInfo", auth.getUserInfo());651 // deferred.resolve(auth.getUserInfo());652 // }653 // else {654 // console.log("I am in the error");655 // deferred.reject({ authenticated: false });656 //657 // }658 // return deferred.promise;659 //660 // }661 })662 .state('previousTrips', {663 url: '/previoustrips',664 templateUrl: '/trips/previousTrips.html',665 controller: 'previousTripsController',666 resolve: {667 isLoggedIn: function(auth,$state,$q ) {668 var deferred =$q.defer();669 var isUser = auth.getUserInfo();670 console.log("Is user",isUser);671 if( isUser.data.user){672 console.log("getUserInfo", auth.getUserInfo());673 deferred.resolve(auth.getUserInfo());674 }675 else {676 console.log("I am in the error");677 deferred.reject({ authenticated: false });678 }679 return deferred.promise;680 }681 }682 })683 .state('auctionTrips', {684 url: '/auctionTrips',685 templateUrl: '/trips/auctionTrips.html',686 controller: 'auctionTripsController',687 resolve: {688 isLoggedIn: function(auth,$state,$q ) {689 var deferred =$q.defer();690 var isUser = auth.getUserInfo();691 console.log("Is user",isUser);692 if( isUser.data.user){693 console.log("getUserInfo", auth.getUserInfo());694 deferred.resolve(auth.getUserInfo());695 }696 else {697 console.log("I am in the error");698 deferred.reject({ authenticated: false });699 }700 return deferred.promise;701 }702 }703});704})705dashboard.directive('starRating', function () {706 return {707 restrict: 'A',708 template: '<ul class="rating">' +...
index.js
Source:index.js
1"use strict";2var _core = _interopRequireDefault(require('../../vendor.js')(0));3var _api = require('../../api/index.js');4function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }5_core["default"].page({6 data: {7 share_uid: '',8 is_shouquan: ''9 },10 methods: {11 checksq: function checksq() {12 var t = this;13 _core["default"].$wx('getSetting').then(function (res) {14 if (res.authSetting['scope.userInfo']) {15 t.is_shouquan = 1;16 _core["default"].$wx('getUserInfo').then(function (r) {17 t.login(r);18 });19 } else {20 t.is_shouquan = 0;21 }22 });23 },24 bindTopUser: function bindTopUser(pid) {25 (0, _api.bindTop)({26 pid: pid27 }).then(function () {});28 },29 login: function login(info) {30 var t = this;31 _core["default"].$wx('login').then(function (res) {32 info.code = res.code;33 info.share_uid = t.share_uid;34 (0, _api.login)(info).then(function (res) {35 if (res.sid) {36 _core["default"].$store.commit('setSID', res.sid);37 }38 var dvInfo = _core["default"].$store.state.deviceInfo;39 dvInfo.appversion = '3.1.4';40 (0, _api.getUserInfo)({41 deviceInfo: dvInfo42 }).then(function (res) {43 _core["default"].$store.commit('setUserInfo', res.datas);44 if (t.share_uid) {45 if (res.datas.is_binded) {46 t.bindTopUser(t.share_uid);47 } else {48 _core["default"].$store.commit('set_share_uid_from', '');49 }50 } else {51 _core["default"].$store.commit('set_share_uid_from', '');52 }53 t.$back();54 });55 })["catch"](function (res) {56 _core["default"].$.confirm('å½åç»å½äººæ°è¿å¤,请ä»æ°ææç»å½');57 t.is_shouquan = 0;58 });59 });60 },61 shouquan_getuserinfo: function shouquan_getuserinfo(e) {62 e = e.$wx;63 var t = this;64 if (e.detail.userInfo) {65 _core["default"].$.loading("ç»å½ä¸...");66 t.login(e.detail);67 } else {68 _core["default"].$.hideloading();69 _core["default"].$.confirm("请ææå°ç¨åºè·å微信åºæ¬ä¿¡æ¯", function () {}, false);70 }71 }72 },73 onLoad: function onLoad(e) {74 // wepy.$.loading('ç»å½ä¸...')75 // console.log(wepy.$.loading);76 if (e && e.share_uid) {77 this.share_uid = e.share_uid;78 }79 this.checksq();80 }81}, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {82 var $event = arguments[arguments.length - 1];83 var _vm=this;84 return (function () {85 _vm.shouquan_getuserinfo($event)86 })();87 88 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {89 var $event = arguments[arguments.length - 1];90 var _vm=this;91 return (function () {92 _vm.shouquan_getuserinfo($event)93 })();94 95 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {96 var $event = arguments[arguments.length - 1];97 var _vm=this;98 return (function () {99 _vm.shouquan_getuserinfo($event)100 })();101 102 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {103 var $event = arguments[arguments.length - 1];104 var _vm=this;105 return (function () {106 _vm.shouquan_getuserinfo($event)107 })();108 109 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {110 var $event = arguments[arguments.length - 1];111 var _vm=this;112 return (function () {113 _vm.shouquan_getuserinfo($event)114 })();115 116 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {117 var $event = arguments[arguments.length - 1];118 var _vm=this;119 return (function () {120 _vm.shouquan_getuserinfo($event)121 })();122 123 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {124 var $event = arguments[arguments.length - 1];125 var _vm=this;126 return (function () {127 _vm.shouquan_getuserinfo($event)128 })();129 130 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {131 var $event = arguments[arguments.length - 1];132 var _vm=this;133 return (function () {134 _vm.shouquan_getuserinfo($event)135 })();136 137 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {138 var $event = arguments[arguments.length - 1];139 var _vm=this;140 return (function () {141 _vm.shouquan_getuserinfo($event)142 })();143 144 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {145 var $event = arguments[arguments.length - 1];146 var _vm=this;147 return (function () {148 _vm.shouquan_getuserinfo($event)149 })();150 151 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {152 var $event = arguments[arguments.length - 1];153 var _vm=this;154 return (function () {155 _vm.shouquan_getuserinfo($event)156 })();157 158 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {159 var $event = arguments[arguments.length - 1];160 var _vm=this;161 return (function () {162 _vm.shouquan_getuserinfo($event)163 })();164 165 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {166 var $event = arguments[arguments.length - 1];167 var _vm=this;168 return (function () {169 _vm.shouquan_getuserinfo($event)170 })();171 172 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {173 var $event = arguments[arguments.length - 1];174 var _vm=this;175 return (function () {176 _vm.shouquan_getuserinfo($event)177 })();178 179 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {180 var $event = arguments[arguments.length - 1];181 var _vm=this;182 return (function () {183 _vm.shouquan_getuserinfo($event)184 })();185 186 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {187 var $event = arguments[arguments.length - 1];188 var _vm=this;189 return (function () {190 _vm.shouquan_getuserinfo($event)191 })();192 193 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {194 var $event = arguments[arguments.length - 1];195 var _vm=this;196 return (function () {197 _vm.shouquan_getuserinfo($event)198 })();199 200 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {201 var $event = arguments[arguments.length - 1];202 var _vm=this;203 return (function () {204 _vm.shouquan_getuserinfo($event)205 })();206 207 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {208 var $event = arguments[arguments.length - 1];209 var _vm=this;210 return (function () {211 _vm.shouquan_getuserinfo($event)212 })();213 214 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {215 var $event = arguments[arguments.length - 1];216 var _vm=this;217 return (function () {218 _vm.shouquan_getuserinfo($event)219 })();220 221 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {222 var $event = arguments[arguments.length - 1];223 var _vm=this;224 return (function () {225 _vm.shouquan_getuserinfo($event)226 })();227 228 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {229 var $event = arguments[arguments.length - 1];230 var _vm=this;231 return (function () {232 _vm.shouquan_getuserinfo($event)233 })();234 235 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {236 var $event = arguments[arguments.length - 1];237 var _vm=this;238 return (function () {239 _vm.shouquan_getuserinfo($event)240 })();241 242 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {243 var $event = arguments[arguments.length - 1];244 var _vm=this;245 return (function () {246 _vm.shouquan_getuserinfo($event)247 })();248 249 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {250 var $event = arguments[arguments.length - 1];251 var _vm=this;252 return (function () {253 _vm.shouquan_getuserinfo($event)254 })();255 256 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {257 var $event = arguments[arguments.length - 1];258 var _vm=this;259 return (function () {260 _vm.shouquan_getuserinfo($event)261 })();262 263 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {264 var $event = arguments[arguments.length - 1];265 var _vm=this;266 return (function () {267 _vm.shouquan_getuserinfo($event)268 })();269 270 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {271 var $event = arguments[arguments.length - 1];272 var _vm=this;273 return (function () {274 _vm.shouquan_getuserinfo($event)275 })();276 277 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {278 var $event = arguments[arguments.length - 1];279 var _vm=this;280 return (function () {281 _vm.shouquan_getuserinfo($event)282 })();283 284 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {285 var $event = arguments[arguments.length - 1];286 var _vm=this;287 return (function () {288 _vm.shouquan_getuserinfo($event)289 })();290 291 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {292 var $event = arguments[arguments.length - 1];293 var _vm=this;294 return (function () {295 _vm.shouquan_getuserinfo($event)296 })();297 298 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {299 var $event = arguments[arguments.length - 1];300 var _vm=this;301 return (function () {302 _vm.shouquan_getuserinfo($event)303 })();304 305 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {306 var $event = arguments[arguments.length - 1];307 var _vm=this;308 return (function () {309 _vm.shouquan_getuserinfo($event)310 })();311 312 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {313 var $event = arguments[arguments.length - 1];314 var _vm=this;315 return (function () {316 _vm.shouquan_getuserinfo($event)317 })();318 319 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {320 var $event = arguments[arguments.length - 1];321 var _vm=this;322 return (function () {323 _vm.shouquan_getuserinfo($event)324 })();325 326 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {327 var $event = arguments[arguments.length - 1];328 var _vm=this;329 return (function () {330 _vm.shouquan_getuserinfo($event)331 })();332 333 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {334 var $event = arguments[arguments.length - 1];335 var _vm=this;336 return (function () {337 _vm.shouquan_getuserinfo($event)338 })();339 340 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {341 var $event = arguments[arguments.length - 1];342 var _vm=this;343 return (function () {344 _vm.shouquan_getuserinfo($event)345 })();346 347 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {348 var $event = arguments[arguments.length - 1];349 var _vm=this;350 return (function () {351 _vm.shouquan_getuserinfo($event)352 })();353 354 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {355 var $event = arguments[arguments.length - 1];356 var _vm=this;357 return (function () {358 _vm.shouquan_getuserinfo($event)359 })();360 361 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {362 var $event = arguments[arguments.length - 1];363 var _vm=this;364 return (function () {365 _vm.shouquan_getuserinfo($event)366 })();367 368 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {369 var $event = arguments[arguments.length - 1];370 var _vm=this;371 return (function () {372 _vm.shouquan_getuserinfo($event)373 })();374 375 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {376 var $event = arguments[arguments.length - 1];377 var _vm=this;378 return (function () {379 _vm.shouquan_getuserinfo($event)380 })();381 382 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {383 var $event = arguments[arguments.length - 1];384 var _vm=this;385 return (function () {386 _vm.shouquan_getuserinfo($event)387 })();388 389 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {390 var $event = arguments[arguments.length - 1];391 var _vm=this;392 return (function () {393 _vm.shouquan_getuserinfo($event)394 })();395 396 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {397 var $event = arguments[arguments.length - 1];398 var _vm=this;399 return (function () {400 _vm.shouquan_getuserinfo($event)401 })();402 403 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {404 var $event = arguments[arguments.length - 1];405 var _vm=this;406 return (function () {407 _vm.shouquan_getuserinfo($event)408 })();409 410 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {411 var $event = arguments[arguments.length - 1];412 var _vm=this;413 return (function () {414 _vm.shouquan_getuserinfo($event)415 })();416 417 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {418 var $event = arguments[arguments.length - 1];419 var _vm=this;420 return (function () {421 _vm.shouquan_getuserinfo($event)422 })();423 424 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {425 var $event = arguments[arguments.length - 1];426 var _vm=this;427 return (function () {428 _vm.shouquan_getuserinfo($event)429 })();430 431 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {432 var $event = arguments[arguments.length - 1];433 var _vm=this;434 return (function () {435 _vm.shouquan_getuserinfo($event)436 })();437 438 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {439 var $event = arguments[arguments.length - 1];440 var _vm=this;441 return (function () {442 _vm.shouquan_getuserinfo($event)443 })();444 445 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {446 var $event = arguments[arguments.length - 1];447 var _vm=this;448 return (function () {449 _vm.shouquan_getuserinfo($event)450 })();451 452 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {453 var $event = arguments[arguments.length - 1];454 var _vm=this;455 return (function () {456 _vm.shouquan_getuserinfo($event)457 })();458 459 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {460 var $event = arguments[arguments.length - 1];461 var _vm=this;462 return (function () {463 _vm.shouquan_getuserinfo($event)464 })();465 466 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {467 var $event = arguments[arguments.length - 1];468 var _vm=this;469 return (function () {470 _vm.shouquan_getuserinfo($event)471 })();472 473 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {474 var $event = arguments[arguments.length - 1];475 var _vm=this;476 return (function () {477 _vm.shouquan_getuserinfo($event)478 })();479 480 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {481 var $event = arguments[arguments.length - 1];482 var _vm=this;483 return (function () {484 _vm.shouquan_getuserinfo($event)485 })();486 487 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {488 var $event = arguments[arguments.length - 1];489 var _vm=this;490 return (function () {491 _vm.shouquan_getuserinfo($event)492 })();493 494 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {495 var $event = arguments[arguments.length - 1];496 var _vm=this;497 return (function () {498 _vm.shouquan_getuserinfo($event)499 })();500 501 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {502 var $event = arguments[arguments.length - 1];503 var _vm=this;504 return (function () {505 _vm.shouquan_getuserinfo($event)506 })();507 508 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {509 var $event = arguments[arguments.length - 1];510 var _vm=this;511 return (function () {512 _vm.shouquan_getuserinfo($event)513 })();514 515 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {516 var $event = arguments[arguments.length - 1];517 var _vm=this;518 return (function () {519 _vm.shouquan_getuserinfo($event)520 })();521 522 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {523 var $event = arguments[arguments.length - 1];524 var _vm=this;525 return (function () {526 _vm.shouquan_getuserinfo($event)527 })();528 529 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {530 var $event = arguments[arguments.length - 1];531 var _vm=this;532 return (function () {533 _vm.shouquan_getuserinfo($event)534 })();535 536 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {537 var $event = arguments[arguments.length - 1];538 var _vm=this;539 return (function () {540 _vm.shouquan_getuserinfo($event)541 })();542 543 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {544 var $event = arguments[arguments.length - 1];545 var _vm=this;546 return (function () {547 _vm.shouquan_getuserinfo($event)548 })();549 550 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {551 var $event = arguments[arguments.length - 1];552 var _vm=this;553 return (function () {554 _vm.shouquan_getuserinfo($event)555 })();556 557 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {558 var $event = arguments[arguments.length - 1];559 var _vm=this;560 return (function () {561 _vm.shouquan_getuserinfo($event)562 })();563 564 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {565 var $event = arguments[arguments.length - 1];566 var _vm=this;567 return (function () {568 _vm.shouquan_getuserinfo($event)569 })();570 571 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {572 var $event = arguments[arguments.length - 1];573 var _vm=this;574 return (function () {575 _vm.shouquan_getuserinfo($event)576 })();577 578 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {579 var $event = arguments[arguments.length - 1];580 var _vm=this;581 return (function () {582 _vm.shouquan_getuserinfo($event)583 })();584 585 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {586 var $event = arguments[arguments.length - 1];587 var _vm=this;588 return (function () {589 _vm.shouquan_getuserinfo($event)590 })();591 592 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {593 var $event = arguments[arguments.length - 1];594 var _vm=this;595 return (function () {596 _vm.shouquan_getuserinfo($event)597 })();598 599 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {600 var $event = arguments[arguments.length - 1];601 var _vm=this;602 return (function () {603 _vm.shouquan_getuserinfo($event)604 })();605 606 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {607 var $event = arguments[arguments.length - 1];608 var _vm=this;609 return (function () {610 _vm.shouquan_getuserinfo($event)611 })();612 613 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {614 var $event = arguments[arguments.length - 1];615 var _vm=this;616 return (function () {617 _vm.shouquan_getuserinfo($event)618 })();619 620 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {621 var $event = arguments[arguments.length - 1];622 var _vm=this;623 return (function () {624 _vm.shouquan_getuserinfo($event)625 })();626 627 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {628 var $event = arguments[arguments.length - 1];629 var _vm=this;630 return (function () {631 _vm.shouquan_getuserinfo($event)632 })();633 634 }}}, models: {} }, {info: {"components":{},"on":{}}, handlers: {'9-0': {"getuserinfo": function proxy () {635 var $event = arguments[arguments.length - 1];636 var _vm=this;637 return (function () {638 _vm.shouquan_getuserinfo($event)639 })();640 ...
controller.js
Source:controller.js
1const UsersRepo = require('../../../models/repositories/user.repository');2const UserSettingRepository = require('../../../models/repositories/settings.repository');3const AutoResponderRepo = require('../../../models/repositories/autoresponder.repository');4const UserHelper = require('../../../Helpers/usersHelper')5const cast = require('TypeCast');6module.exports.autoresponder = async (req, res) => {7 try {8 console.log("This is my sent",req.body.user_id);9 let getUserInfo = await UsersRepo.GetUserById(req.body.user_id);10 if(getUserInfo._id){11 let getUserSettings= await UserSettingRepository.GetUserSettingById(getUserInfo._id);12 let AutoResponderDetails= await AutoResponderRepo.GetAutoResponderResponder(getUserInfo._id);13 if(getUserSettings){14 let AutoResponderDetails= await AutoResponderRepo.GetAutoResponderResponder(getUserInfo._id);15 console.log(AutoResponderDetails);16 res.send({17 code: 1,18 message: "Successfull",19 payload:{setting:getUserSettings.autoresponder,autokey:AutoResponderDetails}20 });21 }else{22 res.send({23 code: 1,24 message: "Successfull",25 payload:026 });27 }28 29 }else{30 res.send({31 code: 4,32 message: "Sorry No Data Of Parent",33 payload: ""34 })35 }36 37 38 } catch (error) {39 res.send({40 code: 3,41 message: error.message,42 payload: error43 })44 }45}46module.exports.updateautoresponder = async (req, res) => {47 try{48 console.log("This is my sent",req.body);49 //let getUserInfo = await UsersRepo.GetUserById(req.body.user_id);50 let getUserSettings= await UserSettingRepository.GetUserSettingById(req.body.user_id);51 console.log(getUserSettings);52 if(getUserSettings){53 let UserSettingsInfoPayload= {54 autoresponder:req.body.autoresponder55 };56 let updateUserSettingsInfo=await UserSettingRepository.UpdateUserSettingsById(req.body.user_id,req.body.autoresponder);57 let userInfo= UserHelper.UserdetailsInfo(req.body.user_id).then(result=>{58 console.log("yo yo +++++++++++++++++",result);59 res.send({60 code: 1,61 message: "Successfull",62 payload: result63 });64 }).catch(error => {65 res.send({66 code: 2,67 message: error.message,68 payload: error69 });70 });71 72 73 }else{74 res.send({75 code: 2,76 message: "Error",77 payload: {}78 });79 }80 // if(getUserInfo._id){81 // let getUserSettings= await UserSettingRepository.GetUserSettingById(getUserInfo._id);82 // if(getUserSettings){83 // let getUserSettingsNew=await UserSettingRepository.UpdateUserSettingsDetails(getUserInfo._id,req.body.autoresponder).then(async result=>{84 // let getUserSettingsUpdated= await UserSettingRepository.GetUserSettingById(getUserInfo._id);85 // res.send({86 // code: 1,87 // message: "Successfull",88 // payload: getUserSettingsUpdated.autoresponder89 // });90 // });91 92 // }else{93 // let UsersSettingsDetailinfo= {94 // user_id: getUserInfo._id,95 // autoresponder: req.body.autoresponder96 // };97 // let getUserSettingsNew=await UserSettingRepository.saveUserSettingsDetails(UsersSettingsDetailinfo).then(async result=>{98 99 // let getUserSettingsUpdated= await UserSettingRepository.GetUserSettingById(getUserInfo._id);100 // res.send({101 // code: 1,102 // message: "Successfull",103 // payload: getUserSettingsUpdated.autoresponder104 // });105 // });106 107 // }108 // }else{109 // res.send({110 // code: 4,111 // message: "Sorry No Data Of Parent",112 // payload: ""113 // })114 // }115 116 } catch (error) {117 res.send({118 code: 3,119 message: error.message,120 payload: error121 })122 }123}124module.exports.createautorespondergroup = async (req, res) => {125 try{126 console.log("This is my sent",req.body);127 let getUserInfo = await UsersRepo.GetUserById(req.body.user_id);128 if(getUserInfo._id){129 let UsersAutoResponderinfo= {130 user_id: getUserInfo._id,131 auto_responder_name: req.body.autoname,132 auto_responder_details:req.body.autodesc,133 message:req.body.automessage,134 status:0135 };136 let AutoResponderGroup=await AutoResponderRepo.CreateAutoResponderGroup(UsersAutoResponderinfo);137 138 let strArr = req.body.autokey.split(',');139 for(var i=0; i<strArr.length; i++){140 let UsersAutoResponderKeywordinfo= {141 user_id: getUserInfo._id,142 auto_responder_id: AutoResponderGroup._id,143 keywords:strArr[i]144 };145 await AutoResponderRepo.CreateAutoResponderKeyword(UsersAutoResponderKeywordinfo);146 }147 res.send({148 code: 1,149 message: "TheKeyWords Is Saved SuccessFully",150 payload: req.body151 }) 152 153 }else{154 res.send({155 code: 3,156 message: "There is a error in user",157 payload: req.body158 }) 159 }160 }catch(error){161 res.send({162 code: 3,163 message: error.message,164 payload: error165 })166 }167}168module.exports.getautoresponderkeywords = async (req, res) => {169 try{170 console.log("This is my sent",req.body);171 let getUserInfo = await UsersRepo.GetUserById(req.body.user.id);172 if(getUserInfo._id){173 let getUserSettings= await UserSettingRepository.GetUserSettingById(getUserInfo._id);174 if(getUserSettings){175 if(getUserSettings.autoresponder === 0){176 res.send({177 code: 1,178 message: "success",179 payload: {user:getUserInfo,autoresponder:0,setting:getUserSettings}180 })181 }else{182 let statusArray = [];183 await AutoResponderRepo.GetAutoResponderKeywords(getUserInfo._id).then(async result=>{184 if(result.length>0){185 186 await result.map(async individual => {187 statusArray.push({keyword:individual.keywords, message:individual.autoresponders[0].message});188 })189 190 }191 });192 res.send({193 code: 1,194 message: "success",195 payload: {user:getUserInfo,autoresponder:1,keywords:statusArray}196 })197 }198 199 }else{200 res.send({201 code: 1,202 message: "success",203 payload: {autoresponder:0}204 })205 }206 }207 208 }catch(error){209 res.send({210 code: 3,211 message: error.message,212 payload: error213 })214 }215}216module.exports.setsetting = async (req, res) => {217 try{218 console.log("This is my sent",req.body);219 let getUserInfo = await UsersRepo.GetUserById(req.body.kyubi_user_token);220 if(getUserInfo._id){221 let getUserSettings= await UserSettingRepository.GetUserSettingById(getUserInfo._id);222 if(getUserSettings){223 console.log("This arexxxxxxxxxxxxx",getUserSettings);224 let UsersSettingsDetailinfo= {225 default_message: req.body.defaultmessage,226 default_message_text: req.body.default_message_text,227 autoresponder: req.body.autoresponder,228 default_time_delay: cast.number(req.body.default_time_delay)229 };230 let UpdateUserSettingsNew=await UserSettingRepository.UpdateUserSettingsDetails(231 getUserInfo._id,232 req.body.defaultmessage,233 req.body.default_message_text,234 req.body.autoresponder,235 cast.number(req.body.default_time_delay)236 );237 let userInfo= UserHelper.UserdetailsInfo(getUserInfo._id).then(result=>{238 console.log("yo yo +++++++++++++++++",result);239 res.send({240 code: 1,241 message: "Successfull",242 payload: result243 });244 }).catch(error => {245 res.send({246 code: 2,247 message: error.message,248 payload: error249 });250 });251 }else{252 let UsersSettingsDetailinfo= {253 user_id: getUserInfo._id,254 default_message: req.body.defaultmessage,255 default_message_text: req.body.default_message_text,256 autoresponder: req.body.autoresponder,257 default_time_delay: cast.number(req.body.default_time_delay)258 };259 let getUserSettingsNew=await UserSettingRepository.saveUserSettingsDetails(UsersSettingsDetailinfo);260 261 let userInfo= UserHelper.UserdetailsInfo(getUserInfo._id).then(result=>{262 console.log("yo yo +++++++++++++++++",result);263 res.send({264 code: 1,265 message: "Successfull",266 payload: result267 });268 }).catch(error => {269 res.send({270 code: 2,271 message: error.message,272 payload: error273 });274 });275 }276 }277 278 }catch(error){279 res.send({280 code: 3,281 message: "Error",282 payload: error.message283 })284 }285}286module.exports.getSetting = async (req, res) => {287 try{288 let getUserInfo = await UsersRepo.GetUserById(req.body.kyubi_user_token);289 if(getUserInfo._id){290 let getUserSettings= await UserSettingRepository.GetUserSettingById(getUserInfo._id);291 if(getUserSettings){292 res.send({293 code: 1,294 message: "success",295 payload: getUserSettings296 })297 }else{298 res.send({299 code: 2,300 message: "success",301 payload: {}302 })303 }304 }else{305 res.send({306 code: 2,307 message: "success",308 payload: {}309 })310 }311 }catch(error){312 res.send({313 code: 3,314 message: "Error",315 payload: error.message316 })317 }318}319module.exports.getUserDetails = async (req, res) => {320 try{321 let userInfo= UserHelper.UserdetailsInfo(req.body.user_id).then(result=>{322 console.log("yo yo +++++++++++++++++",result);323 res.send({324 code: 1,325 message: "Successfull",326 payload: result327 });328 }).catch(error => {329 res.send({330 code: 2,331 message: error.message,332 payload: error333 });334 });335 }catch(error){336 res.send({337 code: 3,338 message: error.message,339 payload: error340 })341 }...
Using AI Code Generation
1var client = require('devicefarmer-stf-client');2client.getUserInfo(function(err, data) {3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var client = require('devicefarmer-stf-client');10client.getDevices(function(err, data) {11 if (err) {12 console.log(err);13 } else {14 console.log(data);15 }16});17var client = require('devicefarmer-stf-client');18client.getDevice('device serial', function(err, data) {19 if (err) {20 console.log(err);21 } else {22 console.log(data);23 }24});25var client = require('devicefarmer-stf-client');26client.getDeviceStatus('device serial', function(err, data) {27 if (err) {28 console.log(err);29 } else {30 console.log(data);31 }32});33var client = require('devicefarmer-stf-client');34client.getDeviceInfo('device serial', function(err, data) {35 if (err) {36 console.log(err);37 } else {38 console.log(data);39 }40});41var client = require('devicefarmer-stf-client');42client.getDeviceLog('device serial', function(err, data) {43 if (err) {44 console.log(err);45 } else {46 console.log(data);47 }48});49var client = require('devicefarmer-stf-client');50client.getDeviceScreenshot('device serial', function(err, data) {51 if (err) {52 console.log(err);53 } else {54 console.log(data);55 }56});57var client = require('devicefarmer-stf-client');58client.getDeviceRemoteConnect('device serial', function(err, data) {59 if (err) {60 console.log(err);61 } else {62 console.log(data);63 }64});
Using AI Code Generation
1var Client = require('devicefarmer-stf-client');2client.getUserInfo(function(err, res){3 if(err){4 console.log(err);5 }else{6 console.log(res);7 }8});9var Client = require('devicefarmer-stf-client');10client.getDevices(function(err, res){11 if(err){12 console.log(err);13 }else{14 console.log(res);15 }16});17var Client = require('devicefarmer-stf-client');18client.getDevices(function(err, res){19 if(err){20 console.log(err);21 }else{22 console.log(res);23 }24});25var Client = require('devicefarmer-stf-client');26client.getDevices(function(err, res){27 if(err){28 console.log(err);29 }else{30 console.log(res);31 }32});33var Client = require('devicefarmer-stf-client');34client.getDevices(function(err, res){35 if(err){36 console.log(err);37 }else{38 console.log(res);39 }40});41var Client = require('devicefarmer-stf-client');42client.getDevices(function(err, res){43 if(err){44 console.log(err);45 }else{46 console.log(res);47 }48});49var Client = require('devicefarmer-stf-client');50client.getDevices(function(err, res){51 if(err){52 console.log(err);53 }else{
Using AI Code Generation
1var stf = require('devicefarmer-stf');2stf.getUserInfo(function (err, res) {3 if (err) {4 console.log(err);5 return;6 }7 console.log(res);8});9var stf = require('devicefarmer-stf');10stf.getDevices(function (err, res) {11 if (err) {12 console.log(err);13 return;14 }15 console.log(res);16});17var stf = require('devicefarmer-stf');18stf.getDevice('device-id', function (err, res) {19 if (err) {20 console.log(err);21 return;22 }23 console.log(res);24});25var stf = require('devicefarmer-stf');26stf.getDevice('device-id', function (err, res) {27 if (err) {28 console.log(err);29 return;30 }31 console.log(res);32});33var stf = require('devicefarmer-stf');34stf.getDevice('device-id', function (err, res) {35 if (err) {36 console.log(err);37 return;38 }39 console.log(res);40});41var stf = require('devicefarmer-stf');42stf.getDevice('device-id', function (err, res) {43 if (err) {44 console.log(err);45 return;46 }47 console.log(res);48});49var stf = require('devicefarmer-stf');50stf.getDevice('device-id', function (err, res) {51 if (err) {52 console.log(err);53 return;54 }55 console.log(res);56});57var stf = require('devicefarmer-stf');
Using AI Code Generation
1var stf = require('devicefarmer-stf-client');2stfClient.getUserInfo(function(err, data){3 if (err) {4 console.log('Error: ' + err);5 }6 else {7 console.log('Data: ' + data);8 }9});10Data: { "success": true, "user": { "email": "
Using AI Code Generation
1var DeviceFarmer = require('devicefarmer-stf-client');2var deviceFarmer = new DeviceFarmer();3deviceFarmer.getUserInfo("username", "password", function(err, data){4 console.log(data);5});6var DeviceFarmer = require('devicefarmer-stf-client');7var deviceFarmer = new DeviceFarmer();8deviceFarmer.getDevices("username", "password", function(err, data){9 console.log(data);10});11var DeviceFarmer = require('devicefarmer-stf-client');12var deviceFarmer = new DeviceFarmer();13deviceFarmer.getDevice("username", "password", "deviceID", function(err, data){14 console.log(data);15});16var DeviceFarmer = require('devicefarmer-stf-client');17var deviceFarmer = new DeviceFarmer();18deviceFarmer.getDevice("username", "password", "deviceID", function(err, data){19 console.log(data);20});21var DeviceFarmer = require('devicefarmer-stf-client');22var deviceFarmer = new DeviceFarmer();23deviceFarmer.getDevice("username", "password", "deviceID", function(err, data){24 console.log(data);25});26var DeviceFarmer = require('devicefarmer-stf-client');27var deviceFarmer = new DeviceFarmer();28deviceFarmer.getDevice("username", "password", "deviceID", function(err, data){29 console.log(data);30});31var DeviceFarmer = require('devicefarmer-stf-client');32var deviceFarmer = new DeviceFarmer();33deviceFarmer.getDevice("username", "password", "deviceID", function(err, data){34 console.log(data);35});36var DeviceFarmer = require('device
Using AI Code Generation
1var stf = require('devicefarmer-stf');2client.getUserInfo("username", function(err, data) {3 if (err) {4 console.log("Error: " + err);5 } else {6 console.log("Data: " + data);7 }8});9var stf = require('devicefarmer-stf');10client.getUserInfo("username", function(err, data) {11 if (err) {12 console.log("Error: " + err);13 } else {14 console.log("Data: " + data);15 }16});17var stf = require('devicefarmer-stf');18client.getUserDevices("username", function(err, data) {19 if (err) {20 console.log("Error: " + err);21 } else {22 console.log("Data: " + data);23 }24});25var stf = require('devicefarmer-stf');26client.getUserDevices("username", function(err, data) {27 if (err) {28 console.log("Error: " + err);29 } else {30 console.log("Data: " + data);31 }32});33var stf = require('devicefarmer-stf');34client.getUserDevices("username", function(err, data) {35 if (err) {36 console.log("Error: " + err);37 } else {38 console.log("Data: " + data);39 }40});41var stf = require('devicefarmer-stf');42client.getUserDevices("username", function(err, data) {43 if (err)
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!