coopcycle-web
coopcycle-web copied to clipboard
Make Tours first class "TaskList" citizens
For now we have :
- frontend code doing complicated stuff
- an endpoint to create/update TaskList which is an ordered list of tasks
- an endpoint to create/update Tour which is an ordered list of tasks
but they are unrelated DB-wise. so if you mess your front end (like https://coopcycle.slack.com/archives/C4UT4DGQ3/p1712301208843109 / fix b7580b14e84cbc9e4b33b33335f9b4f810c09fb8 ). then it could be out of sync, and it is bad.
now it has to be done backend side. but I am not 100% sure that we update Tours and Tasklist always in the same order, or at the same time. Maybe it is necessary, will think about it.
at the moment the simplest solution would be :
- modify tours first in the front end, before we modify the tasklists
- handle the validation in
modifyTaskListAction
(be sure not to make too many requests to get the tour info as well)
I dont know what long term solution should be maybe this one is good. maybe to have an endpoint that can update tour and tasklist at the same time, but it seems quite shitty as well.
also maybe add validation so that task can be in only one tour as well, otherwise we could have bad surprises;
i think we need to refactor our data model for tours, discussion here #4175
that will be quite a ride! 2 days job and thorougful testing