Skip to content

Instantly share code, notes, and snippets.

@tabvn
Last active December 31, 2018 09:02
Show Gist options
  • Select an option

  • Save tabvn/447b762efa12139ac5d17bf7c1f3f8c1 to your computer and use it in GitHub Desktop.

Select an option

Save tabvn/447b762efa12139ac5d17bf7c1f3f8c1 to your computer and use it in GitHub Desktop.

New Report Api docs

All Persons Report

const filterQuery = JSON.stringify({
  from: fromDate,
  to: toDate,
  lead: ["leadId1"],
  persons: ["id1", "id2", ...],
  roles: ["id1", "id2", ...],
  limit: 50,
  skip: 0,
  sort: {totalShows: -1, ratings: -1}
})

path: api/analytics/persons?filter=filterQuery

skip: is for pagination sort: defailt is totalShows DESC, ratings DESC

Sample results:

[
  {
    "_id": "5992d67441735854a9311c17",
    "firstName": "Nick",
    "lastName": "Walsh",
    "kind": "staff",
    "ratings": 97,
    "totalShows": 659
  },
  {
    "_id": "5995d36e61e71c54a042d859",
    "firstName": "Nick",
    "lastName": "Micozzi",
    "kind": "staff",
    "ratings": 98,
    "totalShows": 647
  }
]

Detail Person Report

const filterQuery = JSON.stringify({
  from: fromDate,
  to: toDate,
  roles: ["id1", "id2", ...],
  limit: 50,
  skip: 0,
  sort: {"production.eventDate": -1, score: -1}
})

api/analytics/persons/:id?filter=filterQuery

Sample Results for dertails

  {
    "roleId": "5996007a61e71c54a042d87a",
    "production": {
      "_id": "5b05ca37c922c20dd15d27b3",
      "title": "Sheraton Projection Install DAY 1",
      "show": "Sheraton Projection Install",
      "eventDate": "2018-05-29T16:00:00.000Z",
      "slug": "projection-install",
      "clientId": "5b05c994c922c20dd15d27b0",
      "statusId": "59a8dd8a0a0e5c7d83b3ebc2"
    },
    "client": {
      "_id": "5b05c994c922c20dd15d27b0",
      "company": "B&A - Bernstein & Andriulli"
    },
    "score": 100
  },
  {
    "roleId": "5aa956040a24e06f3b1708b6",
    "production": {
      "_id": "5b75ecc390c62a0e396a1ebd",
      "title": "Pax West Epic Tent Projection Setup Day1",
      "show": "Pax West Epic Tent Projection",
      "eventDate": "2018-08-28T16:00:00.000Z",
      "slug": "pax-west-epic-tent-projection-setup-day1-pax-west-epic-tent-projection",
      "clientId": "5b75ebc290c62a0e396a1ea5",
      "statusId": "59a8dd8a0a0e5c7d83b3ebc2",
      "revenue":	0
    },
    "client": {
      "_id": "5b75ebc290c62a0e396a1ea5",
      "company": "NGE Next Generation Esports"
    },
    "score": 100
  }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment