{"size": 1035, "ext": "js", "max_stars_repo_path": "api/resolvers/query/athlete.js", "max_stars_repo_name": "competitionkit/api", "max_stars_repo_stars_event_min_datetime": "2019-03-14T20:12:49.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-28T01:49:12.000Z", "max_issues_repo_path": "api/resolvers/query/athlete.js", "max_issues_repo_name": "competitionkit/api", "max_issues_repo_issues_event_min_datetime": "2019-07-25T10:49:44.000Z", "max_issues_repo_issues_event_max_datetime": "2020-05-25T01:35:42.000Z", "max_forks_repo_path": "api/resolvers/query/athlete.js", "max_forks_repo_name": "firstmeanseverything/api.firstmeanseverything.com", "max_forks_repo_forks_event_min_datetime": "2018-10-18T08:33:52.000Z", "max_forks_repo_forks_event_max_datetime": "2019-03-15T09:54:13.000Z"}
{"max_stars_count": 18, "max_issues_count": 146, "max_forks_count": 2, "avg_line_length": 19.9038461538, "max_line_length": 74, "alphanum_fraction": 0.5835748792}
const dayjs = require('dayjs')

module.exports = {
  age: async ({ dateOfBirth }, args, ctx) => {
    try {
      const timestamp = new Date().getTime()

      return dayjs(timestamp).diff(dateOfBirth, 'year')
    } catch (e) {
      return e
    }
  },

  finalsLeaderboards: async (
    { finalsLeaderboards: ids },
    args,
    { loaders: { finalsLeaderboardLoader } }
  ) => {
    try {
      const leaderboards = await finalsLeaderboardLoader.loadMany(ids)

      return leaderboards
    } catch (e) {
      return e
    }
  },

  qualifiersLeaderboards: async (
    { qualifiersLeaderboards: ids },
    args,
    { loaders: { qualifiersLeaderboardLoader } }
  ) => {
    try {
      const leaderboards = await qualifiersLeaderboardLoader.loadMany(ids)

      return leaderboards
    } catch (e) {
      return e
    }
  },

  scores: async ({ scores: ids }, args, { loaders: { scoreLoader } }) => {
    try {
      const scores = await scoreLoader.loadMany(ids)

      return scores
    } catch (e) {
      return e
    }
  }
}
