00bd348cf1620c19518a0494ca1c70ccbe22e0fa
[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 _0xb5b1=['preproduction','format','YYYY-MM-DD\x20HH:mm:ss','changed','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','SquareProject','square_projects'];(function(_0x156489,_0x2bbaf2){var _0x4d2814=function(_0x405381){while(--_0x405381){_0x156489['push'](_0x156489['shift']());}};_0x4d2814(++_0x2bbaf2);}(_0xb5b1,0x7c));var _0x1b5b=function(_0x7634c1,_0x520e9e){_0x7634c1=_0x7634c1-0x0;var _0x228414=_0xb5b1[_0x7634c1];return _0x228414;};'use strict';var _=require('lodash');var util=require(_0x1b5b('0x0'));var logger=require(_0x1b5b('0x1'))(_0x1b5b('0x2'));var moment=require(_0x1b5b('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b5b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b5b('0x5'));var config=require(_0x1b5b('0x6'));var attributes=require('./squareProject.attributes');module[_0x1b5b('0x7')]=function(_0x21c0fc,_0x5a9ac7){return _0x21c0fc[_0x1b5b('0x8')](_0x1b5b('0x9'),attributes,{'tableName':_0x1b5b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x373381,_0x29b1e9,_0x1ac0fe){if(_0x373381['changed'](_0x1b5b('0xb'))){_0x373381['savedAt']=moment()[_0x1b5b('0xc')](_0x1b5b('0xd'));}if(_0x373381[_0x1b5b('0xe')]('production')){_0x373381['publishedAt']=moment()[_0x1b5b('0xc')](_0x1b5b('0xd'));}_0x1ac0fe(null,_0x373381);}}});};