Page 496 - Nodejs 교과서 개정2판
P. 496
type: Sequelize.STRING(100),
allowNull: true,
},
provider: {
type: Sequelize.STRING(10),
allowNull: false,
defaultValue: 'local',
},
snsId: {
type: Sequelize.STRING(30),
allowNull: true,
},
}, {
sequelize,
timestamps: true,
underscored: false,
modelName: 'User',
tableName: 'users',
paranoid: true,
charset: 'utf8',
collate: 'utf8_general_ci',
});
}
static associate(db) {
db.User.hasMany(db.Post);
db.User.belongsToMany(db.User, {
foreignKey: 'followingId',
as: 'Followers',
through: 'Follow',
});
db.User.belongsToMany(db.User, {
foreignKey: 'followerId',
as: 'Followings',
through: 'Follow',
});
}
};
ߣ૩ ীח ೣࣻ ഐ ਤೞҊ णפ ࠗ࠙ పझܳ ೞաب ࢿೞ ঋওਵ۽ % F
uncsо ۽ աয়ח Ѫੑפ పझ ழߡܻܳ ৢܻӝ ਤ೧ పझܳ ࢿ೧ࠇद
models/user.test.js