including CAIT data, models and seeds

This commit is contained in:
Eric Hulburd
2016-01-26 19:42:30 -06:00
commit 220ddfed19
47 changed files with 16607 additions and 0 deletions

49
models/house.js Normal file
View File

@@ -0,0 +1,49 @@
import {
GraphQLString,
GraphQLNonNull,
GraphQLObjectType
} from 'graphql';
import {
fromGlobalId,
globalIdField,
nodeDefinitions,
} from 'graphql-relay';
import Database from "./../config/database";
import PowerData from "./power_datum"
/**
* Define your own types here
*/
var House = Database.sequelize.define('House', {
id: {
type: Database.Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true // Automatically gets converted to SERIAL for postgres
},
name: Database.Sequelize.STRING
}, {
tableName: "houses",
instanceMethods: {
},
classMethods: {
associate: function(){
House.hasMany(PowerDatum, {as: 'PowerData'})
}
}
});
House.graphql_type = new GraphQLObjectType({
name: 'House',
description: 'A house',
fields: () => ({
id: globalIdField('House'),
name: GraphQLNonNull(GraphQLInt)
}),
interfaces: [nodeInterface],
});
export House;