This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const db = require('../_db'); | |
const Sequelize = require('sequelize'); | |
class tag_link extends Sequelize.Model { | |
} | |
tag_link.init({ | |
//fill in | |
},{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const db = require('../_db'); | |
const Sequelize = require('sequelize'); | |
class tag_link extends Sequelize.Model { | |
//methods, hooks, etc.... | |
} | |
tag_link.init({ | |
table: { | |
type: Sequelize.STRING, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const db = require('../_db'); | |
const Sequelize = require('sequelize'); | |
class tag extends Sequelize.Model { | |
Associate(Models) { | |
for (const Model of Models) { | |
Model.belongsToMany(this, { | |
foreignKey: 'foreign_key', | |
constraints: false, | |
through: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Story = require('./story'); | |
const Tag = require('./tag'); | |
const TagLink = require('./tagLink'); | |
const User = require('./user'); | |
TagLink.belongsTo(Tag); | |
Tag.Associate([Story, User]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { connect } from 'react-redux' | |
class MyFancyComponent extends React.Component { | |
// react things in here | |
} | |
const mapStateToProps = (state) => { | |
return { users: state.users }; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { connect } from 'react-redux' | |
const mapStateToProps = (state) => { | |
return { users: state.users }; | |
} | |
const mapDispatchToProps = (dispatch, ownProps) { | |
return { | |
getUser(id) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { connect } from 'react-redux' | |
const mapStateToProps = (mapStateToProps, options) => { | |
return connect(mapStateToProps, {}); | |
} | |
const mapDispatchToProps = (mapDispatchToProps, options) => { | |
const mapStateToProps = () => ({}); | |
return connect(mapStateToProps, mapDispatchToProps); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mapDispatchToProps = (dispatch, ownProps) => ({ | |
getUser(id) { | |
dispatch(ownProps.getUser(id)) | |
} | |
}) | |
class MyFancyComponent extends React.Component { | |
// react things | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { mapDispatchToProps, mapStateToProps } from '../myFancyDecorators' | |
@mapStateToProps((state) => ({ | |
users: state.users | |
})) | |
@mapDispatchToProps((dispatch, ownProps) => ({ | |
getUser(id) { | |
dispatch(ownProps.getUser(id)) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE load ADD COLUMN user_id INTEGER; | |
ALTER TABLE load | |
ADD CONSTRAINT user_id_constraint | |
FOREIGN KEY (user_id) | |
REFERENCES human(id); |