peraltawave / phasma

Project 2 Repo // Josh Bilal Alex Miguel
https://infinite-journey-86071.herokuapp.com/
0 stars 0 forks source link

Model Design: Person and Animal #25

Closed peraltawave closed 6 years ago

peraltawave commented 6 years ago

Person Model ######################

// PERSON MODEL
module.exports = function (sequelize, DataTypes) {
    var Person = sequelize.define("Person", {
        personName:
        {
            type: DataTypes.STRING(25),
            allowNull: false,
        },
        personEmail:
        {
            type: DataTypes.STRING(25),
            allowNull: false,
        },
        foundDate: DataTypes.DATEONLY

    });
    return Person;
};

Animal Model

// ANIMAL MODEL
// *********************************************************************************
// THIS RETURNS 'Animal' as a module export, which we can then build posts from
// *********************************************************************************
// DONE BY MIGUEL - this defines the datatype to be used for an Animal only
// 5 nov 2018
// see this github issue for details:
// https://github.com/peraltawave/phasma/issues/24

module.exports = function (sequelize, DataTypes) {
    var Animal = sequelize.define("Animal", {

        animalGenderMale:
        {
            type: DataTypes.BOOLEAN,
            allowNull: false // basically this returns FALSE - so we just need to have the form say Gender: Male? True or False
        },

        animalPic:
        {
            type: DataTypes.STRING(255), // THINKING THIS IS JUST A URL TO A PIC
            allowNull: true,
        },

        animalFeatures:
        {
            type: DataTypes.TEXT, // notes on distinguishing features
            allowNull: true,
        },

        foundStreet1: 
        {
            type: DataTypes.STRING(255),
            allowNull: true,
        },

        foundStreet2: 
        {
            type: DataTypes.STRING(255),
            allowNull: true,
        },

        foundCoordinates:
        {
            latitude: 
            {
                type: DataTypes.FLOAT(10, 6),
                allowNull: true
            },
            longitude: 
            {
                type: DataTypes.FLOAT(10, 6),
                allowNull: true
            }
        }           
    });
    return Animal;
};