// See tags file
var tags = tags.getNames();
var getRandomTag = function() {
- var length = tags.length - 1;
- return [tags[Math.floor(Math.random() * length) + 1]];
+ var length = tags.length - 1;
+ return [tags[Math.floor(Math.random() * length) + 1]];
};
var contacts = [{
- id: 1,
- firstName: 'Mario',
- lastName: 'Rossi',
- phone: '123',
- email: 'mario.rossi@xcally.com',
- ListId: 1,
- CompanyId: 1,
- tags: getRandomTag(),
- description: 'contact auto generated'
+ id: 1,
+ firstName: 'Mario',
+ lastName: 'Rossi',
+ phone: '123',
+ email: 'mario.rossi@xcally.com',
+ ListId: 1,
+ CompanyId: 1,
+ tags: getRandomTag(),
+ description: 'contact auto generated'
}, {
- id: 2,
- firstName: 'Giuseppe',
- lastName: 'Verdi',
- phone: '456',
- email: 'giuseppe.verdi@xcally.com',
- ListId: 1,
- CompanyId: 1,
- tags: getRandomTag(),
- description: 'contact auto generated'
+ id: 2,
+ firstName: 'Giuseppe',
+ lastName: 'Verdi',
+ phone: '456',
+ email: 'giuseppe.verdi@xcally.com',
+ ListId: 1,
+ CompanyId: 1,
+ tags: getRandomTag(),
+ description: 'contact auto generated'
}, {
- id: 3,
- firstName: 'Andrea',
- lastName: 'Bianco',
- phone: '789',
- email: 'andrea.bianco@xcally.com',
- ListId: 2,
- CompanyId: 1,
- tags: getRandomTag(),
- description: 'contact auto generated'
+ id: 3,
+ firstName: 'Andrea',
+ lastName: 'Bianco',
+ phone: '789',
+ email: 'andrea.bianco@xcally.com',
+ ListId: 2,
+ CompanyId: 1,
+ tags: getRandomTag(),
+ description: 'contact auto generated'
}];
exports.create = function() {
- return db.CmContact
- .bulkCreate(contacts, {
- ignoreDuplicates: true,
- individualHooks: true
- })
- .then(function() {
- logger.info('Contacts have been created');
- })
- .catch(function(err) {
- logger.error('Can\'t create Contacts');
- });
-};
+ return db.CmContact
+ .bulkCreate(contacts, {
+ ignoreDuplicates: true,
+ individualHooks: true
+ })
+ .then(function() {
+ logger.info('Contacts have been created');
+ })
+ .catch(function(err) {
+ logger.error('Can\'t create Contacts');
+ });
+};
\ No newline at end of file