mrkrstphr
4/13/2016 - 8:24 PM

database.js

const sunnydaleVFootball = {
  id: '1',
  name: 'Varsity Football',
  sport: 'football',
  teams: [],
};

const knibb = {
  id: '1',
  name: 'Knibb High School',
  state: 'MI',
  teams: [],
};

const bayside = {
  id: '2',
  name: 'Bayside High School',
  state: 'CA',
  teams: [],
};

const shermer = {
  id: '3',
  name: 'Shermer High School',
  state: 'MI',
  teams: [],
};

const johnadams = {
  id: '4',
  name: 'John Adams High School',
  state: 'PA',
  teams: [],
};

const hogwarts = {
  id: '5',
  name: 'Hogwarts School of Witchcraft and Wizardry',
  state: 'MI',
  teams: [],
};

const gotham = {
  id: '6',
  name: 'Gotham Academy',
  state: 'NY',
  teams: ['1'],
};

const sunnydale = {
  id: '7',
  name: 'Sunnydale High School',
  state: 'MI',
  teams: ['1'],
};

const data = {
  School: [
    knibb,
    bayside,
    shermer,
    johnadams,
    hogwarts,
    gotham,
    sunnydale,
  ],
  Team: {
    1: sunnydaleVFootball
  }
};

export function getViewer() {
  return {};
}

export function getSchool(id) {
  return data.School.filter(s => s.id === id)[0];
}

export function getTeam(id) {
  return data.Team[id];
}

export function getSchools() {
  return data.School;
}