text: """
  models.py is generated by flask-sqlacodegen
  pip3 install flask-sqlacodegen
  flask-sqlacodegen --flask --outfile models.py mysql+pymysql://user-name:password@host:port/db-schema
  reference: https://www.devmashup.com/generating-flask-sqlalchemy-models-with-flask-sqlacodegen/
  """
  from flask import Blueprint
  from business.config import Config
  from business.models import Player
  from business.models import TeamPlayer
  from business.models import Team
  import json
  import logging
  
  
  main = Blueprint('main', __name__)
  configuration = Config()
  configuration.log_init()
  logger = logging.getLogger()
  
  
  @main.route("/")
  @main.route("/api/home")
  def home():
      """
      :return:
      res = {
          "meta": {
              "code": 200
          },
          "data": {
              "top_players": [
                  {
                      "player_id": "1301",
                      "player_name": "James Harden",
                      "team_id": "217",
                      "team_name": "Houston Rockets",
                      "picture": "https://d2cwpp38twqe55.cloudfront.net/req/201811081/images/players/thorpot01.jpg"
                  },
                  {},
                  {},
              ],
              "top_teams": [
                  {
                      "team_id": 1301,
                      "team_name": "Houston Rockets",
                      "location": "Houston",
                      "logo": "https://d2p3bygnnzw9w3.cloudfront.net/req/201811271/tlogo/bbr/HOU.png",
                      "big_logo": "https://d2p3bygnnzw9w3.cloudfront.net/req/201811271/tlogo/bbr/HOU.png"
                  },
                  {}
              ]
          }
      }
      """
      # TODO
      players_name_list = configuration.TOP20_PLAYERS
      players_list = []
      for player_name in players_name_list:
          logger.debug(player_name)
          player_temp = Player.query.filter_by(name=player_name).first()
          team_player_temp = TeamPlayer.query.filter_by(player_id=player_temp.id).first()
          team_temp = Team.query.filter_by(id=team_player_temp.team_id).first()
          temp_player = {
              "player_id": str(player_temp.id),
              "player_name": player_name,
              "team_id": str(team_player_temp.team_id),
              "team_name": team_temp.name,
              "picture": player_temp.photo
          }
          players_list.append(temp_player)
      teams_name_list = configuration.TOP20_TEAMS
      teams_list = []
      for team_name in teams_name_list:
          logger.debug(team_name)
          team_temp = Team.query.filter_by(name=team_name).first()
          team = {
              "team_id": str(team_temp.id),
              "team_name": team_name,
              "location": team_temp.location,
              "logo": team_temp.logo,
              "big_logo": team_temp.big_logo
          }
          teams_list.append(team)
      res = {
          "meta": {
              "code": 200
          },
          "data": {
              "top_players": players_list,
              "top_teams": teams_list
          }
      }
      return json.dumps(res)