MSFREACH / msf-reach

Web platform for MSF-REACH
https://msf-reach.org/
4 stars 5 forks source link

fixes #603 #604

Closed matthewberryman closed 6 years ago

matthewberryman commented 6 years ago

Just opening this early for easy comparison of changes for discussion.

matthewberryman commented 6 years ago

@qclin To get the event to re-open you would need to modify the event in the events table (separate to missions) using the put method to set status = 'active' and metadata.event_status to one of "monitoring", "exploration", "intervention", "completed_missions".

qclin commented 6 years ago

@matthewberryman i can send another put request /events/id to set status and event status, but what about the other fields that was updated in body, should take also get PUT ?

qclin commented 6 years ago

@matthewberryman
on PUT events/id I'm getting a 500 error "error: null value in column "type" violates not-null constraint" problem is -- at missions level we don't keep Event type field,

how can i update event without type field? either: 1) client side, grab it somehow (???) and send again, 2) server side make it optional << this i've tried in https://github.com/MSFREACH/msf-reach/pull/604/commits/bd4a84bd9ba39a11065d76908f03324462538f63 but hit a wall when slotting into psql

any clue?

matthewberryman commented 6 years ago

I think rather than https://github.com/MSFREACH/msf-reach/commit/bd4a84bd9ba39a11065d76908f03324462538f63 you would probably need to create a new API method and in the underlying model SQL query just UPDATE the relevant fields (note to update only part of the jsonb field you can use the || concatenate operator with '{"key":"value"}' etc. to only update that key (or keys) and leaving the rest alone.

qclin commented 6 years ago

@matthewberryman okay, i've applied the same solution from compete event > create mission to revive mission > activate event on api side

matthewberryman commented 6 years ago

@LucieGueuning this is going into dev now, following some more testing. To re-open, open an event modal and then set the status back to one of the open statuses. I'd like to give it a bit more time and testing before moving it to prod.