msupply-foundation / unified-codes

Provides a curated, searchable list of pharmaceutical products, each with an immutable code. A GraphQL API, a REST API and website are available for interaction with the database.
https://codes.msupply.foundation
2 stars 0 forks source link

Add mutations to apollo server #93

Open mark-prins opened 3 years ago

mark-prins commented 3 years ago

Add some mutations to Apollo server to enable editing / adding / deleting entities.

Expected Behaviour

Should be able to edit (CRUD) an entity via the API

Possible Solution

wlthomson commented 3 years ago

Not sure if this is just a placeholder for later... but just in case!

IIRC in we don't want to demo mutations for v2 in this sprint? I feel like this is only going to be worth getting into v2 if we can implement authentication + a UI for creating/updating/deleting entity data. Given only a couple of days left, might be good idea to focus on clearing out the review backlog (some of which my fault, but I'm sickly so you can't pick on me).

hide

mark-prins commented 3 years ago

yeah, a placeholder. I was putting the WIP which I'd done in testing the back-end auth into a branch before heading into the murky thicket of PRs-vlille.

wlthomson commented 3 years ago

Oops! Sounds good!

myboy

kat-ms commented 3 years ago

Update: Brain dumped thoughts so far into Possible Solution (for my own future reference and anyone curious/wanting to provide input).

mark-prins commented 3 years ago

@katherine-sussol that looks good!

An additional thought: we're heading toward approvals / drafts and perhaps we could consider soft-delete at some point? I'm not sure that it is required for this project, it was just the comment of deleting a node and all properties & children.. that made me nervous.

If the code is autogenerated, we cannot recreate an accidentally removed node - so perhaps a soft-delete and restore will be needed.

kat-ms commented 3 years ago

Yeah, soft-deletions are probably a good idea, full deletion is pretty final (and maybe best left as an extra-final thing someone can do periodically to clean up soft-deleted nodes).

Thinking we could add a 'deleted' flag to entities? Or create a deleted node and link deleted items as children? Or maybe there are other options... πŸ‘€ πŸ“š: