Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.62 KB | None | 0 0
  1. onst fakeEmail = require('fake-email');
  2. const lorem = require('lorem-ipsum');
  3. const utils = require('./utils');
  4.  
  5. const loremGen = (wNum) => {
  6. return lorem({ count: wNum, units: 'words' });
  7. };
  8.  
  9. /**
  10. * Create new collection specification: Specify new object which key as collection name.
  11. * @amount: it has been set count of new documents.
  12. * @fields: specify generator for new fields. (it can be primitive or function (getter) )
  13. * @specific: specify custom object with predefined fields. You can specify ID of new document there.
  14. *
  15. * */
  16. const schema = {
  17. Users: {
  18. amount: 0,
  19. collection: 'User',
  20. fields: {
  21. username: () => loremGen(3),
  22. email: () => fakeEmail('smarty'),
  23. password: '123123'
  24. },
  25. specific: [
  26. {
  27. _id: '5649fa3a7c8a895b1b08f685',
  28. username: 'test1',
  29. email: 'test1@smarty.com',
  30. password: '123456'
  31. },
  32. {
  33. _id: '5649fa637c8a895b1b08f686',
  34. username: 'test2',
  35. email: 'test2@smarty.com',
  36. password: '123456'
  37. },
  38. {
  39. _id: '56dfce2d52cb531da1b9f085',
  40. username: 'test500',
  41. email: 'test500@smarty.com',
  42. password: '123456'
  43. },
  44. {
  45. _id: '56dfcff452cb531da1b9f086',
  46. username: 'test2500',
  47. email: 'test2500@smarty.com',
  48. password: '123456'
  49. },
  50. {
  51. _id: '56dfd06952cb531da1b9f087',
  52. username: 'test10000',
  53. email: 'test10000@smarty.com',
  54. password: '123456'
  55. },
  56. {
  57. _id: '56dfd0f052cb531da1b9f088',
  58. username: 'test50000',
  59. email: 'test50000@smarty.com',
  60. password: '123456'
  61. },
  62. {
  63. _id: '56c849146f02ffbc0a3e023a',
  64. username: 'jabberadmin',
  65. email: 'jabber@smartycrm.com',
  66. password: '123456'
  67. },
  68. {
  69. _id: '56e0ac1ed7d55debf6a51da8',
  70. username: 'test_start',
  71. email: 'test_start@smartycrm.com',
  72. password: '123123',
  73. quotas: {
  74. contacts: {
  75. limit: 100,
  76. count: 0
  77. },
  78. goals: {
  79. limit: 50,
  80. count: 0
  81. },
  82. groups: {
  83. limit: 50,
  84. count: 0
  85. },
  86. notes: {
  87. limit: 50,
  88. count: 0
  89. },
  90. stages: {
  91. limit: 50,
  92. count: 0
  93. },
  94. tasks: {
  95. limit: 50,
  96. count: 0
  97. },
  98. filesSize: {
  99. limit: 104857600 * 3,
  100. count: 0
  101. },
  102. shares: {
  103. limit: 3,
  104. count: 0
  105. }
  106. },
  107. currentRate: 'start'
  108. }]
  109. },
  110. ContactsForUserTest1: {
  111. amount: 10,
  112. collection: 'Contact',
  113. fields: {
  114. _owner: '5649fa3a7c8a895b1b08f685',
  115. _createdBy: '5649fa3a7c8a895b1b08f685',
  116. name: () => loremGen(3),
  117. city: () => loremGen(1),
  118. country: utils.countryGen()
  119. }
  120. },
  121. ContactsForUserTest2: {
  122. amount: 10,
  123. collection: 'Contact',
  124. fields: {
  125. _owner: '5649fa637c8a895b1b08f686',
  126. _createdBy: '5649fa637c8a895b1b08f686',
  127. name: () => loremGen(3),
  128. city: () => loremGen(1),
  129. country: utils.countryGen()
  130. }
  131. },
  132. ContactsForUserTest100: {
  133. amount: 100,
  134. collection: 'Contact',
  135. fields: {
  136. _owner: '56dfcd4652cb531da1b9f083',
  137. _createdBy: '56dfcd4652cb531da1b9f083',
  138. name: () => loremGen(3),
  139. city: () => loremGen(1),
  140. country: utils.countryGen()
  141. }
  142. },
  143. ContactsForUserTest500: {
  144. amount: 500,
  145. collection: 'Contact',
  146. fields: {
  147. _owner: '56dfce2d52cb531da1b9f085',
  148. _createdBy: '56dfce2d52cb531da1b9f085',
  149. name: () => loremGen(3),
  150. city: () => loremGen(1),
  151. country: utils.countryGen()
  152. }
  153. },
  154. ContactsForUserTest2500: {
  155. amount: 2500,
  156. collection: 'Contact',
  157. fields: {
  158. _owner: '56dfcff452cb531da1b9f086',
  159. _createdBy: '56dfcff452cb531da1b9f086',
  160. name: () => loremGen(3),
  161. city: () => loremGen(1),
  162. country: utils.countryGen()
  163. }
  164. },
  165. ContactsForUserTest10000: {
  166. amount: 10000,
  167. collection: 'Contact',
  168. fields: {
  169. _owner: '56dfd06952cb531da1b9f087',
  170. _createdBy: '56dfd06952cb531da1b9f087',
  171. name: () => loremGen(3),
  172. city: () => loremGen(1),
  173. country: utils.countryGen()
  174. }
  175. },
  176. ContactsForUserTest50000: {
  177. amount: 50000,
  178. collection: 'Contact',
  179. fields: {
  180. _owner: '56dfd0f052cb531da1b9f088',
  181. _createdBy: '56dfd0f052cb531da1b9f088',
  182. name: () => loremGen(3),
  183. city: () => loremGen(1),
  184. country: utils.countryGen()
  185. }
  186. },
  187. GoalsForTest1: {
  188. amount: 10,
  189. collection: 'Goal',
  190. fields: {
  191. _owner: '5649fa3a7c8a895b1b08f685',
  192. _createdBy: '5649fa3a7c8a895b1b08f685',
  193. name: () => loremGen(2),
  194. description: () => loremGen(10)
  195. }
  196. },
  197. NotesForTest1: {
  198. amount: 10,
  199. collection: 'Note',
  200. fields: {
  201. _owner: '5649fa3a7c8a895b1b08f685',
  202. _createdBy: '5649fa3a7c8a895b1b08f685',
  203. title: () => loremGen(2),
  204. description: () => loremGen(10)
  205. }
  206. },
  207. TasksForTest1: {
  208. amount: 10,
  209. collection: 'Task',
  210. fields: {
  211. _owner: '5649fa3a7c8a895b1b08f685',
  212. _createdBy: '5649fa3a7c8a895b1b08f685',
  213. title: () => loremGen(2),
  214. description: () => loremGen(10),
  215. startDate: () => new Date().getTime(),
  216. endDate: () => new Date().getTime()
  217. }
  218. }
  219. /* ... other collection & data */
  220. };
  221.  
  222. const ext = [
  223. {},
  224. schema,
  225. require('./customGenerators/generator10'),
  226. require('./customGenerators/generator100'),
  227. require('./customGenerators/startRate'),
  228. require('./customGenerators/basicRate'),
  229. require('./customGenerators/Oceans50')
  230. ];
  231.  
  232. module.exports = Object.assign.apply(Object, ext);
  233.  
  234.  
  235. "dependencies": {
  236. "async": "^1.5.2",
  237. "config": "^1.19.0",
  238. "fake-email": "0.0.3",
  239. "lodash": "^4.6.1",
  240. "lorem-ipsum": "^1.0.3",
  241. "mongoose": "4.4.7",
  242. "progress": "^1.1.8",
  243. "smarty-db": "git+ssh://git@gitlab.cloudstechnologies.com:backend/smarty-db#v1.1.6",
  244. "smarty-logger": "git+ssh://git@gitlab.cloudstechnologies.com:backend/smarty-logger#v1.1.5",
  245. "smarty-queue": "git+ssh://git@gitlab.cloudstechnologies.com:backend/smarty-queue#v1.0.1"
  246. },
  247. "devDependencies": {
  248. "babel-eslint": "^6.1.0",
  249. "eslint-config-airbnb-base": "^3.0.1",
  250. "eslint-config-smarty": "git+ssh://git@gitlab.cloudstechnologies.com/cloudstech/eslint-config-smarty#v1.1.2",
  251. "eslint-plugin-import": "^1.9.2"
  252. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement