-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_fake-users.js Complete.txt
675 lines (616 loc) · 32.2 KB
/
_fake-users.js Complete.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
const passport = require('passport');
const mongoose = require('mongoose');
const User = mongoose.model('User');
const Post = mongoose.model('Post');
const Comment = mongoose.model('Comment');
let femaleNames = [
"Jessie",
"Emma",
"Olivia",
"Ava",
"Isabella",
"Sophia",
"Charlotte",
"Mia",
"Amelia",
"Harper",
"Evelyn",
"Abigail",
"Emily",
"Elizabeth",
"Mila",
"Ella",
"Avery",
"Sofia",
"Camila",
"Aria",
"Scarlett",
"Victoria",
"Madison",
"Luna",
"Grace",
"Chloe",
"Penelope",
"Layla",
"Riley",
"Zoey",
"Nora",
"Lily",
"Eleanor",
"Hannah",
"Lillian",
"Addison",
"Aubrey",
"Ellie",
"Stella",
"Natalie",
"Zoe",
"Leah",
"Hazel",
"Violet",
"Aurora",
"Savannah",
"Audrey",
"Brooklyn",
"Bella",
"Claire",
"Skylar",
"Lucy",
"Paisley",
"Everly",
"Anna",
"Caroline",
"Nova",
"Genesis",
"Emilia",
"Kennedy",
"Samantha",
"Maya",
"Willow",
"Kinsley",
"Naomi",
"Aaliyah",
"Elena",
"Sarah",
"Ariana",
"Allison",
"Gabriella",
"Alice",
"Madelyn",
"Cora",
"Ruby",
"Eva",
"Serenity",
"Autumn",
"Adeline",
"Hailey",
"Gianna",
"Valentina",
"Isla",
"Eliana",
"Quinn",
"Nevaeh",
"Ivy",
"Sadie",
"Piper",
"Lydia",
"Alexa",
"Josephine",
"Emery",
"Julia",
"Delilah",
"Arianna",
"Vivian",
"Kaylee",
"Sophie",
"Brielle",
"Madeline",
]
let maleNames = [
"Jesse",
"Liam",
"Noah",
"William",
"James",
"Oliver",
"Benjamin",
"Elijah",
"Lucas",
"Mason",
"Logan",
"Alexander",
"Ethan",
"Jacob",
"Michael",
"Daniel",
"Henry",
"Jackson",
"Sebastian",
"Aiden",
"Matthew",
"Samuel",
"David",
"Joseph",
"Carter",
"Owen",
"Wyatt",
"John",
"Jack",
"Luke",
"Jayden",
"Dylan",
"Grayson",
"Levi",
"Isaac",
"Gabriel",
"Julian",
"Mateo",
"Anthony",
"Jaxon",
"Lincoln",
"Joshua",
"Christopher",
"Andrew",
"Theodore",
"Caleb",
"Ryan",
"Asher",
"Nathan",
"Thomas",
"Leo",
"Isaiah",
"Charles",
"Josiah",
"Hudson",
"Christian",
"Hunter",
"Connor",
"Eli",
"Ezra",
"Aaron",
"Landon",
"Adrian",
"Jonathan",
"Nolan",
"Jeremiah",
"Easton",
"Elias",
"Colton",
"Cameron",
"Carson",
"Robert",
"Angel",
"Maverick",
"Nicholas",
"Dominic",
"Jaxson",
"Greyson",
"Adam",
"Ian",
"Austin",
"Santiago",
"Jordan",
"Cooper",
"Brayden",
"Roman",
"Evan",
"Ezekiel",
"Xaviar",
"Jose",
"Jace",
"Jameson",
"Leonardo",
"Axel",
"Everett",
"Kayden",
"Miles",
"Sawyer",
"Jason",
]
let familyNames = [
"Smith",
"Johnson",
"Williams",
"Jones",
"Brown",
"Davis",
"Miller",
"Wilson",
"Moore",
"Taylor",
"Anderson",
"Thomas",
"Jackson",
"White",
"Harris",
"Martin",
"Thompson",
"Garcia",
"Martinez",
"Robinson",
"Clark",
"Rodriguez",
"Lewis",
"Lee",
"Walker",
"Hall",
"Allen",
"Young",
"Hernandez",
"King",
"Wright",
"Lopez",
"Hill",
"Scott",
"Green",
"Adams",
"Baker",
"Gonzalez",
"Nelson",
"Carter",
"Mitchell",
"Perez",
"Roberts",
"Turner",
"Phillips",
"Campbell",
"Parker",
"Evans",
"Edwards",
"Collins",
"Stewart",
"Sanchez",
"Morris",
"Rogers",
"Reed",
"Cook",
"Morgan",
"Bell",
"Murphy",
"Bailey",
"Rivera",
"Cooper",
"Richardson",
"Cox",
"Howard",
"Ward",
"Torres",
"Peterson",
"Gray",
"Ramirez",
"James",
"Watson",
"Brooks",
"Kelly",
"Sanders",
"Price",
"Bennett",
"Wood",
"Barnes",
"Ross",
"Henderson",
"Coleman",
"Jenkins",
"Perry",
"Powell",
"Long",
"Patterson",
"Hughes",
"Flores",
"Washington",
"Butler",
"Simmons",
"Foster",
"Gonzales",
"Bryant",
"Alexander",
"Ussell",
"Griffin",
"Diaz",
"Hayes",
]
let fakePosts = {
hardcodedPosts: [
"Time flies like an arrow. Fruit flies like a banana.",
"The reports of my death have been greatly exaggerated.",
"I have an old VCR. Does anyone want it?",
"Happy ;D",
"Sad :(",
"Derps a lot, everyday.",
"If debugging is the process of removing software bugs, then programming must be the process of putting them in.",
"Deleted code is debugged code.",
"Before you judge a man, walk a mile in his shoes. After that who cares?... He’s a mile away and you’ve got his shoes!",
"People say nothing is impossible, but I do nothing every day.",
"gg",
"Scotland's national animal is the Unicorn.",
"Nobody realizes that some people expend tremendous energy merely to be normal - Pretty much me.",
"Eh.",
"I have a big announcement everyone. I'm going to bed.",
"Practice Makes Permanent",
"It's so cold outside...",
"I need a vacation.",
"Good morning :)",
"Summer soon!",
"Today is soo ughh",
"Facebook just sounds like a drag, in my day seeing pictures of peoples vacations was considered a punishment - Betty White",
"A bank is a place that will lend you money if you can prove that you don’t need it.",
"Great :)",
"I thought today was Friday :(",
"Infinity doesn't exist. Change my mind.",
"Free will doesn't exist. Change my mind.",
"I just fed two birds with one scone.",
"WOW",
"P = NP",
"E = MC^2",
"Over the hills and far away.",
"I like coffee.",
"I'm a robot.",
"Oops...",
"BOOP",
"What if the universe is a simulation?",
"Winner winner chicken dinner.",
"Today is the first day of the rest of your life.",
"I'm flying today!",
"I just found out that some infinites are bigger than other infinites. Mind = Blown.",
"Margaret Thatcher is 110% Sexy",
"The chicken came before the egg.",
"I'm tired.",
"Just woke up :)",
"Finally some good news.",
"It's so simple.",
"...My friend talks too much.",
"Loving this Saturday.",
"My favorite machine at the gym is the vending machine.",
"Don’t worry about the world coming to an end today. It is already tomorrow in Australia.",
"Hello, World",
"I like turtles.",
"0101101001010100101010",
"North Korea and Cuba are the only places you can't buy Coca-Cola.",
"High heels were invented by a woman who had been kissed on the forehead.",
"That was fun!",
"Ouch!!! I stepped on a lego shapped object. ",
"Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu is a place you can visit in New Zealand.",
"There is no place like homework.",
"Angular is pretty cool.",
"The MEAN stack is awesome!",
"<3",
],
lorems: [
"Early adopters business model canvas scrum project. Infographic infrastructure business-to-business termsheet burn rate return on investment. Holy grail non-disclosure agreement marketing. Pitch iPhone technology business-to-consumer freemium.",
"Rockstar iteration business-to-consumer niche market first mover advantage MVP innovator incubator startup. Equity scrum project strategy. Disruptive deployment freemium infrastructure advisor.",
"Freemium interaction design business-to-business innovator termsheet stock release holy grail. Android market innovator metrics business-to-consumer scrum project. Hackathon conversion assets research & development funding ownership agile development backing.",
"Lean startup seed money iteration vesting period entrepreneur beta direct mailing crowdsource long tail assets release. Incubator value proposition leverage handshake bandwidth investo.",
"Low hanging fruit partnership stock niche market early adopters iPad beta buzz market freemium prototype startup stealth. Influencer channels agile development alpha startup gamification hackathon crowdsource.",
"Entrepreneur user experience burn rate mass market bootstrapping focus crowdfunding churn rate. Bandwidth buzz client creative A/B testing alpha android termsheet seed money long tail twitter scrum project infographic.",
"MVP infographic first mover advantage growth hacking gamification traction early adopters focus. Business-to-consumer early adopters innovator social media conversion agile development vesting period technology partner network startup. Conversion launch party infographic.",
"Holy grail lean startup seed round supply chain crowdfunding interaction design gen-z direct mailing business-to-business business plan prototype social proof user experience technology. Ownership hypotheses churn rate iPhone burn rate traction buyer customer first mover advantage.",
"Hypotheses bootstrapping seed money focus facebook release. Analytics release investor advisor branding bandwidth seed round customer ramen gamification infrastructure rockstar innovator first mover advantage. Channels learning curve low hanging fruit. Supply chain accelerator buzz.",
"Release customer client ownership seed money buyer. Mass market user experience product management alpha gamification equity angel investor partnership freemium pivot. Crowdsource direct mailing success angel investor. Freemium iteration investor supply chain.",
"Locals people St. Petersburg yacht guest budget airplane national bus euro Hong Kong. Exchange rate China Moscow St. Petersburg ticket bus camper Budapest dollar apartment sleep France.",
"Stress free dollar booking Instagram activities miles. Nighttrain hospitality train motel bus China. Passport gateway sleep flying overnight transit euro chartering translation car rental rural diary worldwide.",
"Rome spa activities uncharted Brasil tent locals guest. Rural budget Berlin. International lonely planet dollar GEO sight seeing recommendations explore.",
"Package itinerary territory Germany activities country worldwide. Sight seeing activities hiking Rome overnight housing Turkey discover flying on a shoestring Hong Kong outdoor. Boat uncharted animals active lifestyle. Currency wellness horse riding flexibility.",
"Activities territory translation Holland stress free worldwide Germany stay hospitality. Tour operator explore Rome park China national bus travel Australia. Airplane group discount Moscow hotspots flexibility globe outdoor apartment unique experiences people stay hospitality.",
"Expedia park frequent flyer housing maps flexibility group discount currency sight seeing outdoor. AirBnB international spa.",
"Last minute couchsurfing group discount France hospitality freedom. GEO apartment diary international couchsurfing. Chartering territory Europe creditcard explore stress free kayak overnight apartment itinerary.",
"Poland Pacific activities horse riding rural hotspots on a shoestring adventure travel luxury city trip insurance. Berlin foreign airBnB bus diary. Poland creditcard apartment euro cabin overnight. GEO overnight itinerary maps territory New York City Moscow Japan chartering stay. China sleep locals tent Berlin taxi.",
"Poland recommendations Vienna Hong Kong relaxation hiking lonely planet dollar last minute translation cabin. Sleep euro exchange rate hitchhiking things to do. Money Amsterdam explore private jet.",
"Travel hiking motel Instagram. Camper tent nighttrain freedom rural passport housing motel currency tour operator. Transit Paris package city trip foreign. Park Moscow unique experiences Poland frequent flyer Cuba last minute tourist attractions airmiles expedia Instagram GEO Holland sailing. Last minute St. Petersburg.",
"Worldwide unique experiences exchange rate globe private jet Brasil people city trip itinerary diary hospitality. Instagram Rome Barcelona locals tour operator flying boat. Camper itinerary hotspots Tripit rural budget. Discount foreign money.",
"Airmiles money hitchhiking China yacht Vienna travel Asia Turkey group discount active lifestyle wellness international GEO. Hiking Instagram couchsurfing miles yacht package housing St. Petersburg Brasil. Housing animals sight seeing Asia gateway sleep locals Hungary international Instagram.",
"Brasil Poland flexibility insurance foreign diary Instagram South-America sleep hotel territory earth. Spa tent relaxation couchsurfing Asia motel car rental private jet cab earth taxi Australia cabin.",
"Bus flight St. Petersburg currency cabin lodge last minute miles activities Amsterdam spa. Explore booking Turkey Asia couchsurfing hitchhiking. Active lifestyle diary housing hotel camper cabin. Earth tourist attractions hotel Japan discover France caravan Turkey taxi cab airmiles lonely planet. France translator train Pacific.",
"Fresh conserve meals authentic restaurant scent local poultry food heating fork indie foods. Broil blender paprika lasagna sushi groceries romantic biological mustard a la carte. Fork Chinese food sauce local coffee ingredients dish food carrots chef heating.",
"Romantic cafe bar artisan. Bon appetit pie chick peas appliances fruit seafood local apples funghi. Desert a la carte spice oranges beets lobster beverages seafood paprika pepper wholesome.",
"Java authentic soda tasty sausage carrots ginger pasta heating farm. Lobster blender salt lunch drink chopsticks broth funghi Chinese food olive oil cupcake farm sushi.",
"Recommendations taste cookie customer bacon dish heating starter eat better. Take away aroma sweet indie foods cream baking.",
"Soda chopsticks cuisine blender sausage foodtruck groceries al dente. Fish organic spinach banquet ingredients. Wine fork restaurants local deep frying oranges. Biological conserve sausage cupcake food baking artisan ginger.",
"Etiquette organic hummus recommendations. Cuisine sous-chef spice. Apples taste delicious wholesome tasty fish rice chef. Kitchen sour starter. Meat oranges fruit chick peas salami cafe carrots vegetables mustard restaurant indie foods vegetarian farm bacon. Cookie grape blend paprika. Cuisine organic olive oil broil relish beverages. Poultry delicious vegan customer java starter. Main course whipped cream eat better lasagna organic etiquette customer.",
"Biological bacon lobster olive oil first class peas. Herbes custard farm breakfast dinner peas lobster steam chick peas first class fridge a la carte main course. Chef oranges desert beverages yummy luncheon restaurant.",
"Pasta first class breakfast luncheon cafe eat better quinoa cuisine ingredients scent fork biological a la carte. Meals beets pots and pans a la carte bread bon appetit. Meat vegetables food desert sushi delicious sour foodtruck quinoa main course indian marinate scent.",
"Luncheon Chinese food lobster. Steam chocolate eggs plate relish salt indie foods. Chinese food chick peas groceries. Liquor a la carte carbs custard blend Chinese food seafood.",
"Al dente main course wholesome baking sushi sweet salt chef artisan caramelize liquor pizza sous-chef vegetarian. Pub scent banquet. Bacon pub pizza dish fork. Beer lovely dish oranges vegetables coffee relish aroma.",
"Drink biological food mineral water take away fruit pie cream beverages aroma. Barbeque restaurant cupcake foodtruck breakfast protein paprika healthy. Cream grocery shopping fork beverages sustainable eat better biological coffee fruit.",
"Cookie plate chef poultry. A la carte butter dish bacon lasagna appliances banquet. Chinese food artisan bon appetit butter.",
"Eat better fruit spice sustainable chocolate. Protein wine liquor sweet breakfast poultry cook aroma local indie foods. Butter sauce carbs restaurants funghi Chinese food cafe caramelize chef lasagna healthy.",
"Dish taste protein starter sauce grocery shopping lasagna mineral water broil conserve breakfast restaurant sausage pub. Pizza bacon delicious wholesome. Indian conserve bartender. Lasagna scent recommendations artisan tasty marinate eggs fish sustainable.",
"Peas appliances savory oven broil tasty bon appetit breakfast flavor lasagna steam indie foods. Fruit liquor artisan oven vegan drink chocolate eat better sweet indie foods gastronome seafood al dente.",
"Fish oranges main course taste delivery olive oil lunch caramelize apples dinner pots and pans pie Chinese food cheese. Spice conserve broil cuisine desert. Broil vegetarian oven banquet salt rice bon appetit dish.",
"Salt savory desert plate scent organic barbeque. Salami barbeque baking. Funghi foodtruck sauce tea cupcake scent herbes luncheon pasta beverages whipped cream al dente. Eggs main course carbs beer tasty.",
"Apples fish hummus starter bacon customer ginger savory peas. Delicious soda oranges aroma sausage starter sweet hummus lobster plate. Heating sous-chef butter starter ingredients restaurants pizza conserve mineral water scent baking a la carte. Sausage a la carte olive oil ingredients delicious oven carrots chick peas.",
"Yummy deep frying pasta ginger biological quinoa relish cheese healthy luncheon sushi plate herbes restaurants. Rice gluten free aroma. Blender farm tea ginger. Banquet restaurants sweet. Indie foods local chopsticks heating hummus soda sous-chef.",
"I love brownie donut I love sugar plum. Sweet lemon drops fruitcake marshmallow apple pie donut chocolate cake jelly beans.",
"Pie dragée chocolate chocolate halvah gummi bears. Gummies ice cream candy canes I love I love carrot cake liquorice gummies.",
"Ice cream danish ice cream brownie. Candy canes pie I love tart toffee carrot cake jujubes fruitcake sweet.",
"Jelly-o cheesecake I love. I love fruitcake brownie caramels gingerbread cotton candy sweet. Chupa chups muffin cookie.",
"Bear claw wafer cake. Pie oat cake icing cheesecake carrot cake powder fruitcake oat cake. Marzipan cake dragée I love candy canes. Oat cake marzipan ice cream sugar plum. Chocolate cake oat cake lemon drops caramels I love.",
"Lollipop cupcake liquorice oat cake. Bear claw apple pie jelly. I love gingerbread soufflé tootsie roll jelly-o I love chupa chups.",
"Gummi bears candy pie marzipan tiramisu caramels apple pie. Powder croissant chocolate jelly-o topping marzipan lemon drops sweet.",
"Marshmallow macaroon topping cookie. Tart muffin ice cream cookie cake sugar plum tart sesame snaps chupa chups. Powder tiramisu gummies jujubes muffin ice cream chocolate liquorice fruitcake.",
"Dragée pastry I love donut cookie gummi bears. Pastry cupcake jelly cake pie jelly-o ice cream.",
"Cookie pie jelly beans marshmallow tootsie roll chocolate carrot cake. Danish I love soufflé. Brownie carrot cake jelly beans ice cream tiramisu caramels I love.",
"Jelly macaroon icing I love chupa chups. I love jelly-o sweet roll I love. Lemon drops I love candy canes cheesecake soufflé cheesecake. Danish dessert sesame snaps. Cake dessert carrot cake.",
"Cotton candy bonbon ice cream jelly beans tart candy canes. Liquorice carrot cake marshmallow tootsie roll donut chocolate chocolate tootsie roll pastry.",
"Halvah candy canes lemon drops oat cake. Soufflé marshmallow dessert gummi bears chocolate cake caramels.",
"Lollipop ice cream chocolate tiramisu. Biscuit jujubes jujubes tiramisu lemon drops jelly cotton candy brownie gummies. Jelly beans cupcake croissant icing bonbon gummi bears lemon drops.",
"Cake I love tart brownie apple pie jelly pastry tootsie roll I love. Wafer dragée candy. Liquorice I love cake halvah tart toffee candy canes gingerbread. Marshmallow pudding topping apple pie sugar plum cake dessert marzipan.",
"Trade manufacture showcase luxurious. Inspiration inexpensive wardrobe shade waistline bodice couture young jacket bold mode glitter quantity. Make up radical apparel minimalist retailer replicate.",
"Sewing original tones. Conservative stylish one-of-a-kind artistic cut casual inspiration vintage mainstream shade showcase value. Proportion pattern jewelry apron creative celebrities casual imprint cut. Mode petticoat vintage.",
"Hippie artificial xs trade runway contemporary. Shape bargain unique consumer expensive vintage posture garment tones swag contemporary motif bold jeans. Apparel showcase photography cheap one-of-a-kind radical pumps proportion buttons bold.",
"Allure vintage beautiful luxurious color buttons clothing textile inexpensive original ready-made vogue artistic braiding.",
"Jacket contemporary swim-wear xs extraordinary buttons industry radical combination model. Original swim-wear breathable motif artistic. Item cut imprint craftmanship tones modification original easy sari instagram. Young pret-a-porter glossy retailer independant minimalist pumps photography phenomenon shape allure edge.",
"Sari cheap availability proportion vogue trade minimalist inexpensive taste. Fashion urban necessity attractive glossy tones.",
"Stock commercial trade hippie jersey cheap instagram xs pattern quantity bows replicate casual textile. Availability popular bargain apparel stock clothes.",
"Classic artistic prediction embroidery leotard apron phenomenon motif availability condition tones. Expensive ribbon old-fashioned. Look quantity pastel jersey sari wardrobe ready-made.",
"Haute-couture sleeveless commercial bodice buttons collection contemporary one-of-a-kind conformity prediction breathable.",
"Combination piece comfortable artistry catwalk conformity vintage apron apparel phenomenon. Innovation contemporary shawl artistry mannequin xl. Couture ensemble expensive trade trend quantity effect valuable apron item hand-made minimalist young innovation.",
"Imagination celebrities halter expensive item outlet. Impeccable conservative skirt couture. Easy identity collection outlet adjustment comfortable brand classic Haute-couture jewelry.",
"Wardrobe taste xs creative petticoat tones shade. Taste contemporary photography. Pattern ensemble runway quality catwalk comfortable motif purse casual one-of-a-kind trend couture mode modern. Ready-made braiding swag stock adjustment brand.",
"Influence affection Haute-couture quality. Breathable celebrities cut price taste limited replicate catwalk model artistry look. Creative attractive vogue imprint popular sleeveless independant instagram hippie tones piece textile.",
]
}
const getRandom = function(min, max) {
return Math.floor(Math.random() * (max - min) ) + min;
}
const registerFakeUser = function(gender, email) {
// Checks if you should use a female name or male name.
if(gender == "f") {
var firstName = femaleNames[getRandom(0, femaleNames.length - 1)];
} else {
var firstName = maleNames[getRandom(0, maleNames.length - 1)];
}
// The last name is independent of the users gender.
lastName = familyNames[getRandom(0, familyNames.length - 1)];
// This function will return a promise. The promise gets resolved when the user is saved successfully.
return new Promise(function(resolve, reject) {
// Create the user user
let user = new User();
user.name = firstName + " " + lastName;
user.email = email;
// The email follows the same pattern as the name of the images I am using. That's why I'm setting the profile_image to the, "email".
user.profile_image = email;
// All users have the same password, "f". It will allow us to log into any account we want.
user.setPassword("f");
user = createFakePosts(user, getRandom(8, 16));
user.save((err, user) => {
if(err) { reject(); return res.json({err: err}) }
resolve(user);
});
});
}
const createFakePosts = function(user, amountOfPosts) {
function generateContent() {
if(getRandom(0, 100) > 50) {
let index = getRandom(0, fakePosts.hardcodedPosts.length -1)
var content = fakePosts.hardcodedPosts[index];
} else {
let index = getRandom(0, fakePosts.lorems.length -1)
var content = fakePosts.lorems[index];
}
return content;
}
function minutesAgo(n) {
let date = new Date();
date.setMinutes(date.getMinutes() - n);
return date;
}
let themes = ["primary", "info", "success", "warning", "danger", "purple", "pink", "orange"];
let posts = [];
for(let i = 0; i < amountOfPosts; i++) {
let post = new Post();
post.date = minutesAgo(getRandom(1, 2500));
post.content = generateContent();
post.theme = themes[getRandom(0, themes.length - 1)];
posts.push(post);
}
user.posts.push(...posts);
return user;
}
const makeFriends = function(users) {
return new Promise(function(resolve, reject) {
// The loopThroughUsers() function will be called recursively, each time with a smaller array size. (The first value will be chopped from beginning of the array each time.)
function loopThroughUsers(users) {
// This function takes in two users, and adds them to each others friends list.
// It returns a promise that is resolved when both users have been updated and saved.
function addEachOther(user1, user2) {
// This function saves us from having to write the User.findById... code twice, we write it once and then we can call it for each of the users.
function addFriend(user1, user2) {
return new Promise(function(resolve, reject) {
User.findById(user1, (err, user) => {
if(err) { return reject("Error"); }
user.friends.push(user2);
user.save((err) => {
if(err) { return reject("Error"); }
resolve();
});
});
});
}
return new Promise(function(resolve, reject) {
// This will add user2 to the user1 friends list
let p1 = addFriend(user1, user2);
// This will add user1 to the user2 friends list
let p2 = addFriend(user2, user1);
Promise.all([p1, p2]).then((val) => {
resolve("Both friends have added each other.");
});
});
}
// The loopThroughUsers() function will return a promise. It will only be resolved when all recursive calls have resolved. (This goes all the way down until the array size is 0, at which point the resolutions will propagate upwards until reaching this original call.)
return new Promise(function(resolve, reject) {
// When the array size is 0, you want to immediately resolve() the promise.
if(users.length == 0) { return resolve(); }
// Call loopThroughUsers() on a the current users array with the first value removed from the array. Then store that promise in a variable.
// You might ask why remove the first value from the array for the next call of the function?
// We will be looping through the users list and adding friends in that list.
// For the first iteration, we will be checking to add friends to the first user.
// So we might make the user[0] and user[1] friends.
// Or user[0] and user[53] friends, etc.
// By the end of the array, many users will have the first user in the array as a friend. So we don't need to worry about the first user, user[0], anymore.
// In short, we remove the first user from the array so to make it impossible to have duplicates in any friend arrays.
let recursionPromise = loopThroughUsers(users.slice(1));
// Remember that the function that adds the friends together returns a promise, and we'll be adding many friends. We'll store those promises in an array to be used in a Promise.all().
let friendRequestPromises = [];
for(let i = 1; i < users.length; i++) {
// There is a 50% chance of a user adding a user as a friend.
if(getRandom(0, 100) > 50) {
friendRequest = addEachOther(users[0]._id, users[i]._id);
friendRequestPromises.push(friendRequest);
}
}
// Finally, resolve the loopThroughUsers() function when all of it's friendRequests have been resolved, and the recursionPromise has been resolved.
Promise.all([...friendRequestPromises, recursionPromise]).then((val) => {
resolve(val);
});
});
}
// When the original loopThroughUsers() call is resolved, you can resolve the makeFriends promise.
loopThroughUsers(users).then(() => {
console.log("Done looping through users.");
resolve("Resolve makeFriends() Promise");
});
});
}
const createFakeUsers = function(req, res) {
// This function will create 70 new users.
// It will be calling the registerFakeUser function above.
// This function is called AFTER we delete all users, see code below.
function create70Users() {
function create35Users(gender) {
for(let i = 0; i < 35; i++) {
let promise = new Promise(function(resolve, reject) {
registerFakeUser(gender, `${gender}${i + 1}`).then((val) => {
resolve(val);
});
});
promises.push(promise);
}
}
let promises = [];
create35Users("f");
create35Users("m");
return new Promise(function(resolve, reject) {
Promise.all(promises).then((val) => {
resolve(val);
});
});
}
// Before creating users, let's delete the current users.
let deleteUsers = new Promise(function(resolve, reject) {
User.deleteMany({ }, (err, info) => {
if(err) { reject(info); return res.send({ error: err }) }
resolve(info);
});
});
deleteUsers.then((val) => {
create70Users().then((val) => {
makeFriends(val).then((val) => {
console.log("Done making friends, sending back response");
res.statusJson(201, { message: "Created Fake Users" });
});
});
});
}
module.exports = {
createFakeUsers,
}