-
Notifications
You must be signed in to change notification settings - Fork 0
Scc 3733/refactor delivery #605
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
base: main
Are you sure you want to change the base?
Conversation
nonword
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great. OOP for the win
| this.propertiesToOverWrite.forEach((property) => { | ||
| updated[property] = this[property] | ||
| }) | ||
| return updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's going on here?
lib/models/Item.js
Outdated
|
|
||
| Item.updatedWithLocationAndRequestability = (item) => { | ||
| const model = new Item(item) | ||
| return model.updated() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just a factory method? What's model.updated() doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes I had originally build this as a factory method but did not end up using it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea is to overwrite a specific portion of the properties on the item that is passed in
| } | ||
|
|
||
| get deliveryLocationsByM2CustomerCode () { | ||
| if (nyplCore.m2CustomerCodes()?.[this.m2CustomerCode]?.sierraDeliveryLocations) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these also be checking this.nyplCoreLocation.deliverableToResolution before considering returning any locations for the given resolution method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. That is what the code was doing before. Do you remember why we didn't simply rely on the presence of a customer code to use that resolution?
lib/the-thing.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this shouldn't be in here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to be somewhere! I'm not sure where it goes. It surely needs a different name. I was thinking of putting it in something like a scsb requests module... and/or doing the barcode resolution in a slightly different way.
The aim of this work was to consol
deliveryLocationsResolver. this is not totally complete. much of the logic has been moved into the Item and Location models. I want to rechristen it something likelocationUtils, but open to input on how to think about what's left there.attachDeliveryLocationsAndEddRequestabilityentirely. Where this method was once called, instead the Item model factory with updated delivery locations is returned.Itemfactory or update its constructor so the returned item has appropriate values updated (to avoid spread operator biz and having to update individual properties after instantiating item model). This is only for the delivery locations use case for now.Further work to ticket: