Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(data-ingestion): Upload product items from the needs data to the Strapi collection #210

Open
wants to merge 39 commits into
base: saga
Choose a base branch
from

Conversation

ll-zerr
Copy link
Contributor

@ll-zerr ll-zerr commented Nov 26, 2024

What changed?

This pull request currently populates the name field type for the Product.Category collection. It relates to task 1 in PR #112. This collection still requires the items relation field type to be populated.

Still to do in this PR:

  • - Add a unit field type to the Strapi Product.Item collection.
  • - Populate the Strapi Product.Item collection, using the needs data to create items with the following fields - name, age_gender, size_style, category, unit.

**Update: This pull request now populates the Product.Category and Product.Item collections.

How can you test this?

Add the attached needs-data.json file to the src/scripts/import-needs-assessment-data folder, setup the src/scripts/.env file, then run the dev server in one terminal and yarn script:import-needs-assessment-data in another. The logs should show you that 11 categories and 290 products have been created successfully or already exist. (The json file was updated with the full dataset Nov. 28/24)

To test a small amount of data when working with the add-items scripts for the Product.Item collection, use the following demo-data needs-data(1).json instead of the above-noted json file.
The logs should show you the following breakdown:
5 categories processed (either in SUCCESS or ALREADY_EXISTS) and
26 products processed (2 ORIGINAL_DATA_INVALID and 24 in SUCCESS or ALREADY_EXISTS).

@ll-zerr ll-zerr changed the title feat(data-ingestion): Upload product items from the needs data to the Srapi collection feat(data-ingestion): Upload product items from the needs data to the Strapi collection Nov 26, 2024
@phageogram phageogram mentioned this pull request Dec 15, 2024
@ll-zerr ll-zerr marked this pull request as ready for review February 12, 2025 00:55
Copy link

@guel-codes guel-codes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this is great, I left a couple comments for you to review but very solid work!!

There were a couple console.log statements that we might not need anymore. Not sure if those were just for debugging (i.e line 168 of src/scripts/import-needs-assessment-data/add-categories.ts and line 206 of src/scripts/import-needs-assessment-data/add-items.ts)

return validCategories;
}

const isFulfilled = <T>(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this consistent with the _isRejected below? I am fine with with either way, just want to make sure it is consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: @guel-codes, can you clarify what you're referencing as inconsistent between the isFulfilled and _isRejected for further investigation? Thanks.

src/scripts/import-needs-assessment-data/add-categories.ts Outdated Show resolved Hide resolved
return validProducts;
}

const isFulfilled = <T>(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also make this one consistent with the _isRejected below

src/scripts/import-needs-assessment-data/add-items.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants