Built motion from commit b33b832.|1.0.17
[motion.git] / server / models / square_project.js
index 90ae8e6..4179c7f 100644 (file)
@@ -1 +1,40 @@
-var _0x6215=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x53\x71\x75\x61\x72\x65\x50\x72\x6F\x6A\x65\x63\x74","\x53\x54\x52\x49\x4E\x47","\x54\x45\x58\x54","\x6C\x6F\x6E\x67","\x73\x71\x75\x61\x72\x65\x5F\x70\x72\x6F\x6A\x65\x63\x74\x73","\x64\x65\x66\x69\x6E\x65"];_0x6215[0];module[_0x6215[1]]=function(_0xfd55x1,_0xfd55x2){var _0xfd55x3=_0xfd55x1[_0x6215[7]](_0x6215[2],{name:{type:_0xfd55x2[_0x6215[3]],unique:true,validate:{notEmpty:true}},description:_0xfd55x2[_0x6215[3]],preproduction:{type:_0xfd55x2[_0x6215[4]],length:_0x6215[5]},production:{type:_0xfd55x2[_0x6215[4]],length:_0x6215[5]}},{tableName:_0x6215[6]});return _0xfd55x3;};
\ No newline at end of file
+'use strict';
+
+var _ = require('lodash');
+
+module.exports = function(sequelize, DataTypes) {
+
+  var SquareProject = sequelize.define('SquareProject', {
+    name: {
+      type: DataTypes.STRING,
+      unique: 'name',
+      allowNull: false,
+      validate: {
+        notEmpty: true
+      }
+    },
+    description: DataTypes.STRING,
+    notes: DataTypes.TEXT,
+    preproduction: {
+      type: DataTypes.BLOB('long'),
+      get: function() {
+        if (this.getDataValue('preproduction')) {
+          return _.toString(this.getDataValue('preproduction'));
+        }
+      }
+    },
+    production: {
+      type: DataTypes.BLOB('long'),
+      get: function() {
+        if (this.getDataValue('production')) {
+          return _.toString(this.getDataValue('production'));
+        }
+      }
+    }
+  }, {
+    tableName: 'square_projects'
+  });
+
+  return SquareProject;
+
+};