Thank you for this great project. We use this application as an interactive demo for AppMap Navie. The following code and pull request was generated by the Navie AI Architect. Let us know if you would like any other changes.
This fixes #137
Dependencies Added: Introduced @faker-js/faker version 8.4.1 to the project.
Seed Script Enhancements:
Updated the seed script to include product, brand, and category seeding.
Added conditional checks to prevent redundant seeding when sufficient data is already present.
Enhanced seeding logic for admin user creation and data associations between products and categories.
Changes
package.json & package-lock.json:
Added new dependency: @faker-js/faker.
Seed Script (server/utils/seed.js):
Integrated Faker.js for generating sample data.
Implemented checks for existing data to avoid redundant seeding.
Included seeding logic for categories, brands, and products.
Established associations between products and categories.
Ensured proper closure of the MongoDB connection after seeding completion.
Running the seed for the first time:
$ npm run seed:db -- admin@example.com strongpassword
> server@1.0.0 seed:db
> node utils/seed.js admin@example.com strongpassword
✓ Seed database started
✓ MongoDB Connected!
! Seeding admin user...
✓ Admin user seeded.
✓ Categories seeded.
✓ Brands seeded.
✓ Products seeded and associated with categories.
✓ Database connection closed!
Running the seed again later:
$ npm run seed:db -- admin@example.com strongpassword
> server@1.0.0 seed:db
> node utils/seed.js admin@example.com strongpassword
✓ Seed database started
✓ MongoDB Connected!
! Admin user already exists, skipping seeding for admin user.
! Sufficient number of categories already exist, skipping seeding for categories.
! Sufficient number of brands already exist, skipping seeding for brands.
! Sufficient number of products already exist, skipping seeding for products.
✓ Database connection closed!
Thank you for this great project. We use this application as an interactive demo for AppMap Navie. The following code and pull request was generated by the Navie AI Architect. Let us know if you would like any other changes.
This fixes #137
@faker-js/faker
version8.4.1
to the project.Changes
package.json & package-lock.json:
@faker-js/faker
.Seed Script (server/utils/seed.js):
Running the seed for the first time:
Running the seed again later: