{"size": 1063, "ext": "js", "max_stars_repo_path": "imageService/handler.js", "max_stars_repo_name": "slnsw/dxlab-young-ct-2018", "max_stars_repo_stars_event_min_datetime": "2018-03-12T21:21:23.000Z", "max_stars_repo_stars_event_max_datetime": "2018-03-12T21:21:23.000Z", "max_issues_repo_path": "imageService/handler.js", "max_issues_repo_name": "slnsw/dxlab-young-ct-award", "max_issues_repo_issues_event_min_datetime": "2021-03-01T23:09:30.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-08T22:50:04.000Z", "max_forks_repo_path": "imageService/handler.js", "max_forks_repo_name": "slnsw/dxlab-young-ct-award", "max_forks_repo_forks_event_min_datetime": "2019-01-08T01:15:07.000Z", "max_forks_repo_forks_event_max_datetime": "2019-01-08T01:15:07.000Z"}
{"max_stars_count": 1, "max_issues_count": 6, "max_forks_count": 1, "avg_line_length": 20.4423076923, "max_line_length": 62, "alphanum_fraction": 0.5390404516}
'use strict';

const functions = require('./functions');

// Previous bucket name
// const bucket = "samhood";
const bucket = 'dxlab-young-ct-2018-assets';

module.exports.images = (event, context, callback) => {
  return functions
    .images(bucket)
    .then(result => {
      const response = {
        isBase64Encoded: false,
        statusCode: 200,
        headers: {},
        body: result,
      };
      callback(null, response);
    })
    .catch(e => {
      const error = {
        statusCode: 501,
        body: e.message,
      };

      callback(null, error);
    });
};

module.exports.getFaces = (event, context, callback) => {
  return functions
    .getFaces(bucket, 'samhoodfaces', event['query']['image'])
    .then(result => {
      const response = {
        isBase64Encoded: false,
        statusCode: 200,
        headers: {},
        body: result,
      };

      callback(null, response);
    })
    .catch(e => {
      const error = {
        statusCode: 501,
        body: e.message,
      };
      callback(null, error);
    });
};
