9 lines
233 B
JavaScript
9 lines
233 B
JavaScript
import User from './User.js';
|
|
import Post from './Post.js';
|
|
|
|
// Define associations
|
|
User.hasMany(Post, { foreignKey: 'authorId', as: 'posts' });
|
|
Post.belongsTo(User, { foreignKey: 'authorId', as: 'author' });
|
|
|
|
export { User, Post };
|