Built motion from commit f7863d46.|2.5.41
[motion2.git] / server / api / squareProject / squareProject.model.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xfaa9=['publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','SquareProject','square_projects','changed','preproduction','savedAt'];(function(_0x593a74,_0x2f99e4){var _0x42bdcc=function(_0x2a1a90){while(--_0x2a1a90){_0x593a74['push'](_0x593a74['shift']());}};_0x42bdcc(++_0x2f99e4);}(_0xfaa9,0xdb));var _0x9faa=function(_0x48ebb6,_0xfaa9c){_0x48ebb6=_0x48ebb6-0x0;var _0x1b1ed4=_0xfaa9[_0x48ebb6];return _0x1b1ed4;};'use strict';var _=require(_0x9faa('0x0'));var util=require(_0x9faa('0x1'));var logger=require(_0x9faa('0x2'))(_0x9faa('0x3'));var moment=require(_0x9faa('0x4'));var BPromise=require(_0x9faa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9faa('0x6'));var rimraf=require(_0x9faa('0x7'));var config=require(_0x9faa('0x8'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x234729,_0x4237b8){return _0x234729[_0x9faa('0x9')](_0x9faa('0xa'),attributes,{'tableName':_0x9faa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x22fa5e,_0x1fc191,_0x481f2d){if(_0x22fa5e[_0x9faa('0xc')](_0x9faa('0xd'))){_0x22fa5e[_0x9faa('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x22fa5e['changed']('production')){_0x22fa5e[_0x9faa('0xf')]=moment()[_0x9faa('0x10')](_0x9faa('0x11'));}_0x481f2d(null,_0x22fa5e);}}});};