Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onst fakeEmail = require('fake-email');
- const lorem = require('lorem-ipsum');
- const utils = require('./utils');
- const loremGen = (wNum) => {
- return lorem({ count: wNum, units: 'words' });
- };
- /**
- * Create new collection specification: Specify new object which key as collection name.
- * @amount: it has been set count of new documents.
- * @fields: specify generator for new fields. (it can be primitive or function (getter) )
- * @specific: specify custom object with predefined fields. You can specify ID of new document there.
- *
- * */
- const schema = {
- Users: {
- amount: 0,
- collection: 'User',
- fields: {
- username: () => loremGen(3),
- email: () => fakeEmail('smarty'),
- password: '123123'
- },
- specific: [
- {
- _id: '5649fa3a7c8a895b1b08f685',
- username: 'test1',
- email: 'test1@smarty.com',
- password: '123456'
- },
- {
- _id: '5649fa637c8a895b1b08f686',
- username: 'test2',
- email: 'test2@smarty.com',
- password: '123456'
- },
- {
- _id: '56dfce2d52cb531da1b9f085',
- username: 'test500',
- email: 'test500@smarty.com',
- password: '123456'
- },
- {
- _id: '56dfcff452cb531da1b9f086',
- username: 'test2500',
- email: 'test2500@smarty.com',
- password: '123456'
- },
- {
- _id: '56dfd06952cb531da1b9f087',
- username: 'test10000',
- email: 'test10000@smarty.com',
- password: '123456'
- },
- {
- _id: '56dfd0f052cb531da1b9f088',
- username: 'test50000',
- email: 'test50000@smarty.com',
- password: '123456'
- },
- {
- _id: '56c849146f02ffbc0a3e023a',
- username: 'jabberadmin',
- email: 'jabber@smartycrm.com',
- password: '123456'
- },
- {
- _id: '56e0ac1ed7d55debf6a51da8',
- username: 'test_start',
- email: 'test_start@smartycrm.com',
- password: '123123',
- quotas: {
- contacts: {
- limit: 100,
- count: 0
- },
- goals: {
- limit: 50,
- count: 0
- },
- groups: {
- limit: 50,
- count: 0
- },
- notes: {
- limit: 50,
- count: 0
- },
- stages: {
- limit: 50,
- count: 0
- },
- tasks: {
- limit: 50,
- count: 0
- },
- filesSize: {
- limit: 104857600 * 3,
- count: 0
- },
- shares: {
- limit: 3,
- count: 0
- }
- },
- currentRate: 'start'
- }]
- },
- ContactsForUserTest1: {
- amount: 10,
- collection: 'Contact',
- fields: {
- _owner: '5649fa3a7c8a895b1b08f685',
- _createdBy: '5649fa3a7c8a895b1b08f685',
- name: () => loremGen(3),
- city: () => loremGen(1),
- country: utils.countryGen()
- }
- },
- ContactsForUserTest2: {
- amount: 10,
- collection: 'Contact',
- fields: {
- _owner: '5649fa637c8a895b1b08f686',
- _createdBy: '5649fa637c8a895b1b08f686',
- name: () => loremGen(3),
- city: () => loremGen(1),
- country: utils.countryGen()
- }
- },
- ContactsForUserTest100: {
- amount: 100,
- collection: 'Contact',
- fields: {
- _owner: '56dfcd4652cb531da1b9f083',
- _createdBy: '56dfcd4652cb531da1b9f083',
- name: () => loremGen(3),
- city: () => loremGen(1),
- country: utils.countryGen()
- }
- },
- ContactsForUserTest500: {
- amount: 500,
- collection: 'Contact',
- fields: {
- _owner: '56dfce2d52cb531da1b9f085',
- _createdBy: '56dfce2d52cb531da1b9f085',
- name: () => loremGen(3),
- city: () => loremGen(1),
- country: utils.countryGen()
- }
- },
- ContactsForUserTest2500: {
- amount: 2500,
- collection: 'Contact',
- fields: {
- _owner: '56dfcff452cb531da1b9f086',
- _createdBy: '56dfcff452cb531da1b9f086',
- name: () => loremGen(3),
- city: () => loremGen(1),
- country: utils.countryGen()
- }
- },
- ContactsForUserTest10000: {
- amount: 10000,
- collection: 'Contact',
- fields: {
- _owner: '56dfd06952cb531da1b9f087',
- _createdBy: '56dfd06952cb531da1b9f087',
- name: () => loremGen(3),
- city: () => loremGen(1),
- country: utils.countryGen()
- }
- },
- ContactsForUserTest50000: {
- amount: 50000,
- collection: 'Contact',
- fields: {
- _owner: '56dfd0f052cb531da1b9f088',
- _createdBy: '56dfd0f052cb531da1b9f088',
- name: () => loremGen(3),
- city: () => loremGen(1),
- country: utils.countryGen()
- }
- },
- GoalsForTest1: {
- amount: 10,
- collection: 'Goal',
- fields: {
- _owner: '5649fa3a7c8a895b1b08f685',
- _createdBy: '5649fa3a7c8a895b1b08f685',
- name: () => loremGen(2),
- description: () => loremGen(10)
- }
- },
- NotesForTest1: {
- amount: 10,
- collection: 'Note',
- fields: {
- _owner: '5649fa3a7c8a895b1b08f685',
- _createdBy: '5649fa3a7c8a895b1b08f685',
- title: () => loremGen(2),
- description: () => loremGen(10)
- }
- },
- TasksForTest1: {
- amount: 10,
- collection: 'Task',
- fields: {
- _owner: '5649fa3a7c8a895b1b08f685',
- _createdBy: '5649fa3a7c8a895b1b08f685',
- title: () => loremGen(2),
- description: () => loremGen(10),
- startDate: () => new Date().getTime(),
- endDate: () => new Date().getTime()
- }
- }
- /* ... other collection & data */
- };
- const ext = [
- {},
- schema,
- require('./customGenerators/generator10'),
- require('./customGenerators/generator100'),
- require('./customGenerators/startRate'),
- require('./customGenerators/basicRate'),
- require('./customGenerators/Oceans50')
- ];
- module.exports = Object.assign.apply(Object, ext);
- "dependencies": {
- "async": "^1.5.2",
- "config": "^1.19.0",
- "fake-email": "0.0.3",
- "lodash": "^4.6.1",
- "lorem-ipsum": "^1.0.3",
- "mongoose": "4.4.7",
- "progress": "^1.1.8",
- "smarty-db": "git+ssh://git@gitlab.cloudstechnologies.com:backend/smarty-db#v1.1.6",
- "smarty-logger": "git+ssh://git@gitlab.cloudstechnologies.com:backend/smarty-logger#v1.1.5",
- "smarty-queue": "git+ssh://git@gitlab.cloudstechnologies.com:backend/smarty-queue#v1.0.1"
- },
- "devDependencies": {
- "babel-eslint": "^6.1.0",
- "eslint-config-airbnb-base": "^3.0.1",
- "eslint-config-smarty": "git+ssh://git@gitlab.cloudstechnologies.com/cloudstech/eslint-config-smarty#v1.1.2",
- "eslint-plugin-import": "^1.9.2"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement