farmOS / field-kit

A modular, offline-first companion app to farmOS.
https://farmOS.org
GNU General Public License v3.0
60 stars 39 forks source link

Logs API: CRUD Operations #383

Closed jgaehring closed 3 years ago

jgaehring commented 4 years ago

Provide the basic operations for creating, reading, updating and deleting logs.

jgaehring commented 4 years ago

I'm not sure yet if I want to implement those operations as plain Vuex mutations and actions, or perhaps wrap them in component methods that I add to all components as a mixin, or if I even want to forgo Vuex all together and roll my own state management tool just for FK.

jgaehring commented 4 years ago

358 is relevant to this issue as well.

jgaehring commented 4 years ago

Another possibility is using Vue's event emitters.

jgaehring commented 3 years ago

Pretty much done with these operations, with the exception of delete. I'm going to punt on that for now, because I think it will require a gradual transition in our UX, to go from "deleting" logs locally, as we are now, to "hiding" logs. Although there's also the question of how unsynced logs will differ, because they may have changes that are lost, even if the original log still lives on the server.

Regardless, I think as far as the API is concerned, even if we come back to add some delete functionality, we have a good pattern established.

Some remaining issues:

First, do we want to leave updateLog as it is, where the user has to call

this.$store.commit('updateLog', payload);

Or do we want to apply a mixin which maps mutations and actions (including initializeLog, syncLog, etc) to component methods, using Vuex's mapMutation and mapAction helpers? I wouldn't want to apply that mixin globally, but perhaps just for the root component of every module.

Second, I still need to document the CRUD operations. Perhaps it would inform the first question if I took a stab at that first, and see if it makes sense that way, before I enshrine it in code.

jgaehring commented 3 years ago

Resolved by #404.