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] Project reward claims stock #39

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

subiabre
Copy link
Member

In #36 were added the models necessary to store project rewards and user claims for rewards.

This PR implements the business logic necessary to make the reward claims work when they have limited units, making each reward claim substract from the available units in the reward.

@subiabre subiabre requested a review from davidbeig December 13, 2024 13:33
@subiabre subiabre self-assigned this Dec 13, 2024
@subiabre subiabre marked this pull request as ready for review December 16, 2024 12:36
@subiabre
Copy link
Member Author

subiabre commented Dec 16, 2024

@davidbeig can you give this a good look for a review?

I'm concerned about solidifying the custom providers / processors to specify custom behavior, inject the service / business logic on resources. I tried to build this feature leaning as much into the logic model as possible and leaving reusable pieces for the future. The gist of it is that the generic, default processing flow by ApiPlatform for entities has been encapsulated in a reusable, re-injectable EntityStateProcessor, which in turn gets called by custom state processors for resources after these map the resource to an entity and after applying custom service logic to the entity object under certain their considered conditions.

This means, ultimately, that Rewards have a RewardStateProcessor which sets the available units from the total units on new rewards, and RewardClaims have a RewardClaimStateProcessor that substracts from the Reward on new reward claims.

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.

1 participant