Open chandler37 opened 6 years ago
we need a hierarchical causes database so you can
POST /api/v1/causes {cause: {name: "Health"}} receiving {id: "1"...}
and subsequently
POST /api/v1/causes {cause: {name: "Disease Amelioration", parent_id: "1"}} receiving {id: "2"...}
and then
PATCH /api/v1/charities/1 {charity: {cause_id: "2"}}
or perhaps instead
POST /api/v1/charities/1/causes to append a cause without wiping out existing causes?
GET /api/v1/causes/2?page=1&per_page=10 receiving {child_causes: [], charities: [{id: "1"...
A charity can have more than one leaf cause, let's say both /Health/Disease and /Education/Children, 4 causes total.
GET /api/v1/causes?depth=1 will yield only /Health and /Education
we need a hierarchical causes database so you can
POST /api/v1/causes {cause: {name: "Health"}} receiving {id: "1"...}
and subsequently
POST /api/v1/causes {cause: {name: "Disease Amelioration", parent_id: "1"}} receiving {id: "2"...}
and then
PATCH /api/v1/charities/1 {charity: {cause_id: "2"}}
or perhaps instead
POST /api/v1/charities/1/causes to append a cause without wiping out existing causes?
and then
GET /api/v1/causes/2?page=1&per_page=10 receiving {child_causes: [], charities: [{id: "1"...
A charity can have more than one leaf cause, let's say both /Health/Disease and /Education/Children, 4 causes total.
GET /api/v1/causes?depth=1 will yield only /Health and /Education