diff --git a/models/index.js b/models/index.js index 70650a38212c453e5ff4147587dc8cd450b6f659..e4c4b6cc80107bfe28d820a4a50c289024fd6e87 100644 --- a/models/index.js +++ b/models/index.js @@ -6,6 +6,7 @@ const Schedule = require('./Schedule'); const Meeting = require('./Meeting'); const Friend = require('./Friend'); const FcmToken = require('./fcmToken'); +const Invite =require('./Invite') const MeetingParticipant = require('./MeetingParticipant'); // const ChatRooms = require('./ChatRooms'); @@ -27,6 +28,13 @@ User.hasMany(MeetingParticipant, { foreignKey: 'user_id', as: 'meetingParticipat Schedule.belongsTo(User, { foreignKey: 'user_id', as: 'user' }); User.hasMany(Schedule, { foreignKey: 'user_id', as: 'schedules' }); +Invite.belongsTo(Meeting, { foreignKey: 'meeting_id', as: 'meeting' }); +Invite.belongsTo(User, { foreignKey: 'inviter_id', as: 'inviter' }); // 珥덈��� �ъ슜�� +Invite.belongsTo(User, { foreignKey: 'invitee_id', as: 'invitee' }); // 珥덈�諛쏆� �ъ슜�� + +User.hasMany(Invite, { foreignKey: 'inviter_id', as: 'sentInvites' }); // 蹂대궦 珥덈� 紐⑸줉 +User.hasMany(Invite, { foreignKey: 'invitee_id', as: 'receivedInvites' }); // 諛쏆� 珥덈� 紐⑸줉 +Meeting.hasMany(Invite, { foreignKey: 'meeting_id', as: 'invites' }); // �대떦 誘명똿�� 紐⑤뱺 珥덈� module.exports = { sequelize, @@ -37,4 +45,5 @@ module.exports = { MeetingParticipant, Friend, FcmToken, + Invite, };