Feature (development) #14991
openFeature - Claimable tasks
100%
Description
The goal of this feature is to expand the functionality of task service to include claimable tasks - tasks which only award rewards after they are claimed. The claiming of the task is done in a seperate endpoint with the task_id and user_id as parameters.
Multiple claimable solution options:
1. Insert claimable into tags - maybe the best solution, dont know what it might break, tags dont seem to be used
2. create new column claimable
3. use configuration json
New assigned task state flow
- ACTIVE
- FAILED
- ABANDONED
- COMPLETED
- CLAIMED if claimable
Expiration of tasks should work the same, if you competed the task and didnt claim you dont get anyhing, and if its not claimable then just send rewards as before.
Sending rewards:
Options:
- Send rewards from task service to where it has to go depending on reward configuration
- Send task completed event to related servcies and handle the task event there and distribute rewards accordingly
- if we go with this approach it would be appropriate to restructure atleast at first the new tasks to have rewards as a dictionary not as with keys being the name of the service, so we can access related rewards in that service
Tasks:
- Get familiar with task service structure, notably the task model and methods and expiration of tasks
- Investigate if its possible to include 'claimable' into tags and integrate it into the functions and queries
- Add new state of tasks (CLAIMED) and implement endpoints to get list of claimable tasks with paginations for user and endpoint to claim task
- EP to claim task
- should take a user_id and list of task_ids
- Should return proper and meaningfull internal exceptions, as they will be handled on php proxy layer, you can choose to handle middleware connections issues as well with retry if you want but for the sake of time its not required
- EP to claim task
- Reward, if claimable then reward thoruhg EP if not then keep the current logic
Add a amount field to either extras and configuration and add this "amount" to GET endpoint so its available for PHP, alongside the "game" parameter in extras