Source: modules/airport.js

"use strict";

/**
 * Define module airport
 */

module.exports = function(sequelize, DataTypes){
  return sequelize.define("airport", {
    airport_id: {
      type: DataTypes.STRING,
      primaryKey: true
    },
    latitude: {
      type: DataTypes.TEXT
    },
    longitude: {
      type: DataTypes.TEXT
    },
    name: {
      type: DataTypes.TEXT
    },
    nickname: {
      type: DataTypes.TEXT
    },
    iata: {
      type: DataTypes.TEXT
    },
    icao: {
      type: DataTypes.TEXT
    }
  }, {
    /**
     * Getter methods for Airports Module.
     * @property {method} getName Returns the name of the airport.
     * @property {method} getLocation Returns the latitude and the longitude
     * @property {method} getLatitude Returns the latitude.
     * @property {method} getLongitude Returns the longitude.
     */
    getterMethods: {
      getName: function () {
        return this.name;
      },
      getLocation: function() {
        return this.latitude + " " + this.longitude;
      },
      getLatitude: function() {
        return this.latitude;
      },
      getLongitude: function(){
        return this.longitude;
      }
    },
    tableName: "airports",
    timestamps: false
  });
};