Merged PetitTetonApps with the website now that the deployment server always uses SSL. Used the Apps more recent implementation of NodeJS/Express.

This commit is contained in:
Wynne Crisman
2016-05-31 14:37:42 -07:00
parent a98d7d3a5f
commit 78be012a14
192 changed files with 58459 additions and 19 deletions

31
app/models/category.js Normal file
View File

@@ -0,0 +1,31 @@
"use strict";
module.exports = function(sequelize, DataTypes) {
//The id field is auto added and made primary key.
var Category = sequelize.define('Category', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
autoIncrement: true
},
name: {
type: DataTypes.STRING,
allowNull: false
},
visible: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true
}
}, {
freezeTableName: true, // Model tableName will be the same as the model name
classMethods: {
associate: function(models) {
Category.hasMany(models.Subcategory, {as: 'subcategories', foreignKey: {name: 'categoryId', field: 'categoryId'}});
}
}
});
return Category;
};