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(fulfillment): Module service implementation first iteration #6381

Merged
merged 39 commits into from
Feb 14, 2024

Conversation

adrien2p
Copy link
Member

@adrien2p adrien2p commented Feb 12, 2024

What

Tip

The review should particularly focus on the module service implementation and the integration tests to ensure that the behavior conforms to the expectations. In Sus, the adjustments made to the models and DTO's

Warning

The delete methods are kept aside as it will require manually cascading since according to the doc, cascade remove on collection will perform one query per item. In that case I rather prefer deleting them manually in bulk.

  • Preliminary migration file
    • Does not include changes to be integrated with existing tables from the core, so probably not to review unless for indexes and modules schema expectations
  • Events will be managed separately later on
  • Update some indexes and unique indexes
  • Start implementing the module service with the following
    • create - To create fulfillment set including service zones and geo zones
    • createServiceZones - To create service zones and geo zones that can be attached to a fulfillment set on update
    • update - To update a fulfillment set and allow to replace/add/remove service zones
    • updateServiceZones - Update service zones with their geo zones to either attach an existing zones or create a new one or replace existing ones
    • create geo zones
    • update geo zones
    • soft delete are based from the abstraction
    • list/retrieve/listAndCount are based from the abstraction
  • Few adjustments in regards to the DTO's
  • Integration tests for the above module service

FIXES CORE-1716
FIXES CORE-1734

Copy link

changeset-bot bot commented Feb 12, 2024

🦋 Changeset detected

Latest commit: 0d8a946

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@medusajs/types Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Feb 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2024 4:53pm
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Feb 14, 2024 4:53pm
docs-ui ⬜️ Ignored (Inspect) Visit Preview Feb 14, 2024 4:53pm
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Feb 14, 2024 4:53pm

kodiakhq bot pushed a commit that referenced this pull request Feb 12, 2024
**What**
Fix the test utils database to trully run the migrations, the migration path is deprecated and not used anymore as umzung infer the path under the hood. It also fix the schema so that it is possible to specify different schema if needed.

The index helper can now create named constraints for uniqueness. 

extracted [from](#6381)
Copy link
Collaborator

@srindom srindom left a comment

Choose a reason for hiding this comment

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

Very nice work - have a few comments on the data model. Might make sense to address as part of this PR, but up to you.

Copy link
Collaborator

@srindom srindom left a comment

Choose a reason for hiding this comment

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

LGTM!

inverseJoinColumn: "service_zone_id",
@OneToMany(() => ServiceZone, "fulfillment_set", {
cascade: [Cascade.PERSIST, "soft-remove"] as any,
orphanRemoval: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

question: I thought we didn't use this because of its "aggressiveness". I am fine to keep it in, but just wanted to point it out in case it was an oversight

Copy link
Member Author

Choose a reason for hiding this comment

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

Here it a requirements. Because since i am bulk deleting the entities, then when mikro orm manage the collection under the hood it will complain that thos configuration is missing. Also, i am in a case where if the fulfillment set is removed completely, then we can have orphan service zones since the foreign key is non nullable. Same goes between service zones and geo zones

inverseJoinColumn: "geo_zone_id",
@OneToMany(() => GeoZone, "service_zone", {
cascade: [Cascade.PERSIST, "soft-remove"] as any,
orphanRemoval: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

@olivermrbl
Copy link
Contributor

@adrien2p feel free to merge 🚢

@adrien2p adrien2p merged commit fafde4f into develop Feb 14, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants