Is your feature request related to a problem? Please describe.
Yes, the website looks empty and some aspects can't be tested without additional posts
Describe the solution you'd like
Add an automated way to populate the website with fake data
Additional context
could possibly use FakerJS
shouldn't be done until more model architecture is finalized
Development
[x] research FakerJS and other possible solutions
decided to use FakerJS and build a separate script for fake data injection
[x] get post image to stop changing every refresh and be different
tried generated a random image each time
but now none of the links work
had to pass in dimensions and now it works
[x] fix categories not being linked to posts properly
had to map each chosen category to a name for insertion
[x] "Fake" category shouldn't be injected into DB since only devs should be able to use it
Votes should also be injectable into the system or posts should be created with a random reputation score
votes could be linked to fake users so they already have basis w/ logged into
but would be more difficult to test what would happen at different reputation scores
would needa create an insane amt of votes + ensure each one's properly contributed to an appropriate post if a certain score needs reaching for testing
but creating votes would allow for testing if user rep increases if they contribute enough votes
also, all user votes should be shown somewhere
so should prolly do a combination of random rep score along with specified number of votes
[x] user linked votes aren't deleted with them
bc delete votes w/ user if deleted, but only during the API call
needa do in node script
after #11 change from vote authorId to username, simple deletion call
[x] create a specified number of votes based on if option
to properly model system, should model each vote originating from a user
so need as many users as upper bounds of reputation desired by a post
which should go all to a little over the highest badge
author can't vote on their own post so shouldn't be exact
can manufacture more users explicitly to create the votes and not have them author any posts
would require
tried creating enough votes to put each post into a different badge range
realized everytime create a vote, post rep doesnt automatically increase
only increased bc of call api does
same for why badge updated
so could just straightup create new votes with a new user for each
wouldn't needa try to get votes allocated properly at all
[x] add badges to posts
have to rando alloc post rep score
then test to see where within badges bounds falls
can do same way did in API using sorted list + insertion index
[x] add badges to users
bu for user badges and bp for post badges?
could just pass a "-b" to indicate want there to be badges on everything that can have them
no reason to have a limited number of badges i suppose
or to just give posts badges and not users
add badges by default now, not dependent on option
[x] randomize some post scores
[x] randomize some user scores based on if option
[x] determine why all users and votes not always deleted + fix
1 user and their votes survived it last time
happens bc not all users are guaranteed authors of a fake post
so they aren't deleted at deletion time
happens by random chance
could assign each user a random post, then in subsequent posts choose the author randomly
would require posts >= users
[x] fake publish date of posts
adding a "createAt" date to the fake post worked perfectly!
[x] allow for entering of options in any order for insertion
installed minimalist-lite package instead of using a for-loop
parsed cmd line args into a dict for position independent option entering
[x] fake post comments
structured in the same way as votes
since wanted each post to contain comments under it given by each user
rolled a random every comment creation to see if a reply to any previous comments would be created
rolled another random to decide the comment to be replied to
then added the new replied to comment to the root comment's replies
in API, only root comment has replies arr added to tho
so I had to change it to do the same
replyId not being set for some reason
or replies array
because _id field not init'd till posted to db
so need create fake comments, post to db, then create fake replied from those
then gonna have to update originally posted comments too since replies field changed
due to the complexity of this, just gonna post og comments, create replies, delete og's, then post all of them
did this and worked but had to compare object id's in special way
haven't been able to verify whether replies to other replies are being faked occasionally
seems like they aren't tho
[x] make sure replies to other replies are being created
everytime not replying to root comment directly, reply not added to root comment replies
bc root comment can't be found
bc new reply comment not having its replyId set properly
should possibly set it as a string??
not the problem
since reply comment not posted to database yet, doesn't have _id field
so, would have to post og comments, post reply comment, then post reply to reply comments
shouldn't require any comment deletion
wrong since still adding replies to already posted comments
so could once again try updating since now only picking comment to reply to from explicit pool
could update same way deleting rn i think
could also reuse same method for both reply comment creation
[x] create realistic fake comment dating
bounded it between time of post creation
should bound between comment replying to if there is one
unfortunately, replies ordered by when they were added in display
so this way of adding dates works but doesn't display well
[x] delete fake comments
delete comments author'd by fake usernames
[x] speed up updating of root comments
did so thru performing a "Bulk Write"
could've allegedly used aggregation pipeline but couldn't get working
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Additional context
Development
[x] research FakerJS and other possible solutions
[x] get post image to stop changing every refresh and be different
[x] fix categories not being linked to posts properly
[x] "Fake" category shouldn't be injected into DB since only devs should be able to use it
Votes should also be injectable into the system or posts should be created with a random reputation score
[x] user linked votes aren't deleted with them
[x] create a specified number of votes based on if option
[x] add badges to posts
[x] add badges to users
[x] randomize some post scores
[x] randomize some user scores based on if option
[x] determine why all users and votes not always deleted + fix
[x] fake publish date of posts
[x] allow for entering of options in any order for insertion
[x] fake post comments
[x] make sure replies to other replies are being created
[x] create realistic fake comment dating
[x] delete fake comments
[x] speed up updating of root comments
[x] only add up to 2 cats per post
[x] determine why faked images suddenly won't render
[ ] delete all comments replying to comments author'd by fake usernames
[ ] populate post descriptions with faked html for better visualization
[ ] figure out why images take so long to load
[ ] figure out + fix how urls generated for social media links are dead
[ ] figure out why test data images occasionally change + fix them