Departments

Departments can be used to group product types for reporting.

The department object

{
 "id": "5e253ffd-007c-435f-ad56-ff06649d06d5",
 "title": "Wine Product",
 "code": "Wine",
 "createdAt": "2018-05-18T16:53:46.597Z",
 "updatedAt": "2018-05-18T16:53:46.597Z"
}

Create a department

POST: /department

{
 "title": "Glass Products",
 "code": "GlassProducts"
}

RESPONSE: responds with a department object.

Retrieve a department

GET: /department/:id

RESPONSE: responds with a department object.

Update a department

PUT: /department/:id

{
 "title": "Glass Products No Lead",
 "code": "GlassProducts"
}

RESPONSE: responds with a department object.

Delete a department

DELETE: /department/:id

RESPONSE: responds with a blank object and 204 status.

List all departments

GET: /department

OPTIONS: optional query parameters include: q.

RESPONSE: responds with an array of department objects and a total count.

{
 "departments": [{
  "id": "aec8ab99-cbdd-4f6f-9862-f104e24bdc5f",
  "title": "Glass Products No Lead",
  "code": "GlassProducts",
  "createdAt": "2018-05-21T23:27:25.921Z",
  "updatedAt": "2018-05-21T23:30:35.031Z"
 }, {
  "id": "5e253ffd-007c-435f-ad56-ff06649d06d5",
  "title": "Wine Product",
  "code": "Wine",
  "createdAt": "2018-05-18T16:53:46.597Z",
  "updatedAt": "2018-05-18T16:53:46.597Z"
 }],
 "total": 2
}