Built motion from commit b7ec679.|0.0.83
[motion.git] / server / models / cm_company.js
1 /**
2  * tag Model
3  */
4
5 module.exports = function(sequelize, DataTypes) {
6
7   var Company = sequelize.define('Company', {
8     name: {
9       type: DataTypes.STRING,
10       unique: true
11     },
12     vat: DataTypes.STRING,
13     companyId: DataTypes.STRING,
14     website: DataTypes.STRING,
15     email: DataTypes.STRING,
16     phone: DataTypes.STRING,
17     fax: DataTypes.STRING,
18     type: DataTypes.STRING,
19     street: DataTypes.STRING,
20     postalCode: DataTypes.STRING,
21     city: DataTypes.STRING,
22     country: DataTypes.STRING,
23     sStreet: DataTypes.STRING,
24     sPostalCode: DataTypes.STRING,
25     sCity: DataTypes.STRING,
26     sCountry: DataTypes.STRING,
27   }, {
28     tableName: 'cm_companies',
29     associate: function(models) {
30       Company.hasMany(models.Contact, {
31         as: 'Contacts'
32       });
33     }
34   });
35
36   return Company;
37 };