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

Schedule price change for the future #190

Open
andrzejkrzywda opened this issue Oct 28, 2022 · 7 comments
Open

Schedule price change for the future #190

andrzejkrzywda opened this issue Oct 28, 2022 · 7 comments
Labels
good first issue Good for newcomers

Comments

@andrzejkrzywda
Copy link
Contributor

I'm not sure, but maybe one possible approach to this would be https://railseventstore.org/docs/v2/bi-temporal/ Bi-temporal Event Sourcing, where we publish a normal PriceSet event, but we set the valid_at metadata.

@mpraglowski sounds good?

@mpraglowski
Copy link
Member

Bi-temporal Event Sourcing will be fine when you have situation where "business validity date" is different than event publication date - seems to be a good match here.

@lukaszreszke lukaszreszke self-assigned this Nov 2, 2022
@lukaszreszke
Copy link
Collaborator

Backend part is now committed in b7c8395
However, there are some concerns about the solution. Please check the commit message.

@andrzejkrzywda
Copy link
Contributor Author

Thanks for the implementation!

It's much easier to reason about this strategy when we see the code.

I agree with the pros/cons.

What alternatives do we have?

Sending commands to the future?

@lukaszreszke
Copy link
Collaborator

I didn't think about this. Scheduling commands for the future sounds like an alternative. But it seems like we'd have to build some infrastructure in order to achieve that. And also, low chance, that the command might be rejected and the price wouldn't be applied. Such a situation would be highly undesired when using some kind of pricing planning strategy. But that's a low chance. Reasons for failure might be different however the outcome would be harmful.

When we were implementing the scheduling feature with @fidel we thought that perhaps we should consider a different model for pricing. Initial idea was that we could have the valid_since date. It eventually evolved and we thought that maybe price could also be available in a certain period of time. When I think about this now, maybe some kind of period. Open-ended. Close-ended. Not sure if those are proper domain names. What do you think about such an approach/direction?

I would also like to highlight the fact that the current solution is acceptable in my opinion. If time to market would be the only factor I think it's a good value for time spent. Also not that hard to change in the future. However, it feels like debt in terms of the domain model. Perhaps we're limiting ourselves, but we don't know yet about the potential use case. Or we don't know the domain enough, yet.

@lukaszreszke
Copy link
Collaborator

We had some discussions and this is clarified for me now. If you think about your events as part of the domain, then this solution makes total sense 👍

@lukaszreszke
Copy link
Collaborator

Only the backend part is finished. UI is still up for grabs

@tomaszpatrzek
Copy link
Collaborator

@tomaszpatrzek tomaszpatrzek removed their assignment Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants