unee-t / frontend

Meteor front end
https://case.dev.unee-t.com/
GNU Affero General Public License v3.0
9 stars 17 forks source link

feat: user api keys for MEFE interaction; get units API #774

Closed nbiton closed 5 years ago

nbiton commented 5 years ago

Functional changes

  1. The internal "CREATE_USER" enterprise API now returns a user API key for the created user.
  2. When "CREATE_USER" is called for an existing user, a new user API key is generated and returned in the response. Previous API keys are not revoked as a result, and the "creatorId" provided with the request is recorded as the issuer/generator of the API key.
  3. GET /api/units has been made available. It expects apiKey as a query param. It checks if the apiKey is valid, associated with a user and not revoked, before returning a JSON array of object of the following form:
    {
        "_id": String (ObjectId),
        "displayName": String,
        "unitType": String (enum),
        "createdAt": String (Date in ISO format),
        "streetAddress": String,
        "city": String,
        "zipCode": String,
        "state": String,
        "country": String,
        "moreInfo": String
    }

This PR should resolve #773

nbiton commented 5 years ago

The example request relevant to the new endpoint is named "Get accessible units' meta data for a given user with api key" on our Postman account

nbiton commented 5 years ago

The new attribute returned from the "CREATE_USER" internal API is named mefeApiKey. It is a 24-character long string.