whisky_collector/backend/src/models/index.js

30 lines
528 B
JavaScript
Raw Normal View History

2025-03-05 13:26:43 -05:00
const { sequelize } = require('../config/db');
const User = require('./User');
const Whiskey = require('./Whiskey');
const Collection = require('./Collection');
const Rating = require('./Rating');
// Define relationships
User.hasMany(Collection);
Collection.belongsTo(User);
Whiskey.hasMany(Collection);
Collection.belongsTo(Whiskey);
User.hasMany(Rating);
Rating.belongsTo(User);
Whiskey.hasMany(Rating);
Rating.belongsTo(Whiskey);
// Exports
module.exports = {
User,
Whiskey,
Collection,
Rating,
sequelize
};