Ok, looks like there is actually a lot of logic that is backend-only. See, for example, the (t *Task) Update function. Marking a task as “done” is not just a matter of flipping its done property. See the updateDone function. There’s plenty of stuff going on. If you send done: true to the backend it could flip it back, depending on, for example, the repeat_after property.
I’m afraid that simply translating the Go backend to JS is not the way to go.
Solutions:
- Strip off some of the functions, like repeating tasks.
- Actually try to make a best-effort Go-to-JS translation, with no guarantees that it’s gonna behave exactly the same as the original one.
- Try to modify the upstream repos, transfer as much logic as we can to the front-end, i.e. make it so that the front-end doesn’t try to set
done: trueif the backend would actually flip it back tofalse.
It seems kind of weird that if you senddone: trueit returnsdone: falseanyway. But maybe it’s because the alternative is to make a properly named and described endpoint, while keeping the logic the same. - Somehow use the actual Go backend. Translate it to WASM + JS with Emscripten? That would make the bundle super big. And can you translate the database that the backend uses as well?