-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add linkedEvent column to OrderPickupEvent Table #385
Conversation
Thanks for contributing! |
I do api change tmrw I am sleepy |
@@ -110,6 +110,7 @@ export class MerchFactory { | |||
orderLimit: FactoryUtils.getRandomNumber(1, 5), | |||
status: OrderPickupEventStatus.ACTIVE, | |||
orders: [], | |||
linkedEvent: null, |
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 I import the EventFactory and generate an actual dummy event to put in here? Are there any other test cases that could be beneficial for this feature?
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 don't actually think so. I actually don't think it is clean to attach a dummy event everytime we mock a pickupEvent as sometimes pickupEvent doesn't have an actual linkedEvent attached.
I don't believe it is necessary to implement a solution for this now, but for future reference, if there is a new feature that actually depends on linkedEvent, we should come up with a nice way (such as taking an optional boolean flag variable to attach event) to attach dummy linkedEvent to the mocked pickupEvent.
@OneToOne((type) => EventModel, { nullable: true }) | ||
@JoinColumn({ name: 'linkedEvent' }) | ||
linkedEvent: EventModel; | ||
|
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.
Can you double check this relation–I found a few different syntax examples online but I believe this establishes the correct one-way relation.
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.
This looks good to me.
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.
A few nits. Remember to attach postman screenshots.
|
||
if (changes.linkedEventUuid) { | ||
const linkedRegularEvent = await this.getLinkedRegularEvent(changes.linkedEventUuid); | ||
updatedPickupEvent.linkedEvent = linkedRegularEvent; |
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.
u should save the event into the repository after editing the linkedEvent
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.
lets also create a unit test to test for this
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.
This method is called when a pickup event is edited, so only the UUID of the linkedEvent would be changed. I made a call to the upsert function on line 1076, which should be the only call necessary to save this change, right?
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.
oh yeah you are right about that
@@ -110,6 +110,7 @@ export class MerchFactory { | |||
orderLimit: FactoryUtils.getRandomNumber(1, 5), | |||
status: OrderPickupEventStatus.ACTIVE, | |||
orders: [], | |||
linkedEvent: null, |
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 don't actually think so. I actually don't think it is clean to attach a dummy event everytime we mock a pickupEvent as sometimes pickupEvent doesn't have an actual linkedEvent attached.
I don't believe it is necessary to implement a solution for this now, but for future reference, if there is a new feature that actually depends on linkedEvent, we should come up with a nice way (such as taking an optional boolean flag variable to attach event) to attach dummy linkedEvent to the mocked pickupEvent.
@OneToOne((type) => EventModel, { nullable: true }) | ||
@JoinColumn({ name: 'linkedEvent' }) | ||
linkedEvent: EventModel; | ||
|
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.
This looks good to me.
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.
LGTM 🚀 🚀 🚀 🚀 🚀
|
||
if (changes.linkedEventUuid) { | ||
const linkedRegularEvent = await this.getLinkedRegularEvent(changes.linkedEventUuid); | ||
updatedPickupEvent.linkedEvent = linkedRegularEvent; |
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.
oh yeah you are right about that
…into feature/linked-event-column merging from master
Description
Need a way to tie order pickup events to real events so that frontend can display things like the event graphic
Changes
Type of Change
expected)
workflows, linting, etc.)
If you've selected Patch, Minor, or Major as your change type, make sure to bump the version before merging in
package.json
!Testing
I have tested that my changes fully resolve the linked issue ...
Checklist
package.json
file.Screenshots
Please include a screenshot of your Postman testing passing successfully.