windyScripts / dev-directory

21 stars 5 forks source link

#39 create seed script #74

Closed jmoldyvan closed 1 year ago

jmoldyvan commented 1 year ago

Closes #39

Description

This PR creates a seed.ts file and the ability to run that file as the scrip npm run seed script which will insert 100 random users into the database via a transcript. The PR also adds a makeUser function to the server/test/utils.ts file in order to use bulkCreate when creating the 100 users to reduce the amount of db inserts, improving efficiency.

Testing

Enter npm run seed and then check the db is 100 users is created

Type of change

Checklist:

jmoldyvan commented 1 year ago

So I'm pretty sure I did everything part of the comments left, however I couldn't get the

export type UserFields = Omit<User, 'id'>;

to work with the updated createManyUsers function... I wanted to commit so I didn't lose any progress, but accidently pushed out of habit

jmoldyvan commented 1 year ago

Finished up all the requested changes. Got the Omit working. Made the seed function itself dynamic? But yeah, got it all good to go

jmoldyvan commented 1 year ago

So I'm not sure why but it's not working on my local machine now...

Caleb-Cohen commented 1 year ago

So I'm not sure why but it's not working on my local machine now...

It looks like it's working on mine.

devonzara commented 1 year ago

@Caleb-Cohen I believe his comment was before our pair programming session yesterday evening, there's been a commit since then and all CI tests have passed. 👍🏼