osmlab / to-fix-backend

The to-fix server
BSD 3-Clause "New" or "Revised" License
15 stars 13 forks source link

Update Items endpints #143

Closed emilymdubois closed 6 years ago

emilymdubois commented 7 years ago

We're going to use both POST and PUT operations, so we need to update how we create projects.

Similar to tags, we'll want users to be able to pass an optional query parameter to filter projects by name instead of ID. Below, all instances of :item can be assumed to mean item ID, and all instances of item can be assumed to mean item name.

@batpad @kepta @samanpwbb


Get all project items

GET /projects/:project/items

Query parameters

Name Type Description
item string Optional. May be passed to filter returned items where item name contains the provided string.

Create an item

POST /projects/:project/items

Payload parameters

Name Type Description
name string Required. The item name.
instructions string Required. The instructions on how to work on the item.
pin string Required. A 2D geometry point to represent the feature.
status enum Optional. The status of ticket. Defaults to open.
featureCollection object Optional. A GeoJSON context feature.
lock enum Optional. Item's locked status.

Get an item

GET /projects/:project/items/:item

Update an item

PUT /projects/:project/items/:item

Payload parameters

Name Type Description
name string Optional. The item name.
instructions string Optional. The instructions on how to work on the item.
pin string Optional. A 2D geometry point to represent the feature.
status enum Optional. The status of ticket. Defaults to open.
featureCollection object Optional. A GeoJSON context feature.
lock enum Optional. Item's locked status.

Delete an item

DELETE /projects/:project/items/:item
batpad commented 7 years ago

Add name to the item schema since id will now be an auto-generated integer

@emilymdubois if the id is ever going to be user facing, for eg. in a URL, I'd strongly advocate for uuids and not auto incrementing integers. Happy to talk through.

emilymdubois commented 7 years ago

@batpad yes, I think we could keep the auto_id as the primary but masked ID, and then add an immutable field on a create operation that the user would use to in URL paths. PagerDuty always uses a 6-character string that always starts with P.

samanpwbb commented 6 years ago

Closed by https://github.com/osmlab/to-fix-backend/pull/162