diff --git a/back/models/Member.js b/back/models/Member.js index 4a9dfa9..47155ae 100644 --- a/back/models/Member.js +++ b/back/models/Member.js @@ -8,13 +8,11 @@ module.exports = function(sequelize, DataTypes) { }, uid: { type: DataTypes.STRING(30), - allowNull: true, - unique: "uid" + allowNull: true }, kaist_uid: { type: DataTypes.STRING(30), - allowNull: true, - unique: "kaist_uid" + allowNull: true }, sid: { type: DataTypes.STRING(30), @@ -61,22 +59,6 @@ module.exports = function(sequelize, DataTypes) { { name: "student_id" }, ] }, - { - name: "uid", - unique: true, - using: "BTREE", - fields: [ - { name: "uid" }, - ] - }, - { - name: "kaist_uid", - unique: true, - using: "BTREE", - fields: [ - { name: "kaist_uid" }, - ] - }, ] }); }; diff --git a/back/models/init-models.js b/back/models/init-models.js index 3180a51..0d6b5d2 100644 --- a/back/models/init-models.js +++ b/back/models/init-models.js @@ -68,10 +68,7 @@ function initModels(sequelize) { var ActivityEvidence = _ActivityEvidence(sequelize, DataTypes); var ActivityEvidence_init = _ActivityEvidence_init(sequelize, DataTypes); var ActivityFeedback = _ActivityFeedback(sequelize, DataTypes); - var ActivityFeedbackExecutive = _ActivityFeedbackExecutive( - sequelize, - DataTypes - ); + var ActivityFeedbackExecutive = _ActivityFeedbackExecutive(sequelize, DataTypes); var ActivityFeedbackType = _ActivityFeedbackType(sequelize, DataTypes); var ActivityMember = _ActivityMember(sequelize, DataTypes); var ActivityMember_init = _ActivityMember_init(sequelize, DataTypes); @@ -100,21 +97,12 @@ function initModels(sequelize) { var FundingFeedback = _FundingFeedback(sequelize, DataTypes); var FundingFeedbackType = _FundingFeedbackType(sequelize, DataTypes); var FundingFixture = _FundingFixture(sequelize, DataTypes); - var FundingFixtureObjectType = _FundingFixtureObjectType( - sequelize, - DataTypes - ); + var FundingFixtureObjectType = _FundingFixtureObjectType(sequelize, DataTypes); var FundingFixtureType = _FundingFixtureType(sequelize, DataTypes); var FundingNoncorp = _FundingNoncorp(sequelize, DataTypes); var FundingTransportation = _FundingTransportation(sequelize, DataTypes); - var FundingTransportationMember = _FundingTransportationMember( - sequelize, - DataTypes - ); - var FundingTransportationType = _FundingTransportationType( - sequelize, - DataTypes - ); + var FundingTransportationMember = _FundingTransportationMember(sequelize, DataTypes); + var FundingTransportationType = _FundingTransportationType(sequelize, DataTypes); var Meeting = _Meeting(sequelize, DataTypes); var MeetingMemberType = _MeetingMemberType(sequelize, DataTypes); var MeetingType = _MeetingType(sequelize, DataTypes); @@ -124,23 +112,11 @@ function initModels(sequelize) { var PermanentClub = _PermanentClub(sequelize, DataTypes); var Registration = _Registration(sequelize, DataTypes); var RegistrationActivity = _RegistrationActivity(sequelize, DataTypes); - var RegistrationActivityEvidence = _RegistrationActivityEvidence( - sequelize, - DataTypes - ); - var RegistrationActivityFeedback = _RegistrationActivityFeedback( - sequelize, - DataTypes - ); - var RegistrationActivityMember = _RegistrationActivityMember( - sequelize, - DataTypes - ); + var RegistrationActivityEvidence = _RegistrationActivityEvidence(sequelize, DataTypes); + var RegistrationActivityFeedback = _RegistrationActivityFeedback(sequelize, DataTypes); + var RegistrationActivityMember = _RegistrationActivityMember(sequelize, DataTypes); var RegistrationEvidence = _RegistrationEvidence(sequelize, DataTypes); - var RegistrationEvidenceType = _RegistrationEvidenceType( - sequelize, - DataTypes - ); + var RegistrationEvidenceType = _RegistrationEvidenceType(sequelize, DataTypes); var RegistrationFeedback = _RegistrationFeedback(sequelize, DataTypes); var RegistrationMember = _RegistrationMember(sequelize, DataTypes); var RegistrationSign = _RegistrationSign(sequelize, DataTypes); @@ -152,595 +128,174 @@ function initModels(sequelize) { var Warning = _Warning(sequelize, DataTypes); var sessions = _sessions(sequelize, DataTypes); - Club.belongsToMany(Semester, { - as: "semester_id_Semesters", - through: ActivitySign, - foreignKey: "club_id", - otherKey: "semester_id", - }); - Club.belongsToMany(Semester, { - as: "semester_id_Semester_SemesterClubs", - through: SemesterClub, - foreignKey: "club_id", - otherKey: "semester_id", - }); - Funding.belongsToMany(Member, { - as: "student_id_Members", - through: FundingTransportationMember, - foreignKey: "funding_id", - otherKey: "student_id", - }); - Member.belongsToMany(Funding, { - as: "funding_id_Fundings", - through: FundingTransportationMember, - foreignKey: "student_id", - otherKey: "funding_id", - }); - Member.belongsToMany(RegistrationActivity, { - as: "activity_id_RegistrationActivities", - through: RegistrationActivityMember, - foreignKey: "member_student_id", - otherKey: "activity_id", - }); - Member.belongsToMany(Semester, { - as: "semester_id_Semester_MemberStatuses", - through: MemberStatus, - foreignKey: "student_id", - otherKey: "semester_id", - }); - RegistrationActivity.belongsToMany(Member, { - as: "member_student_id_Members", - through: RegistrationActivityMember, - foreignKey: "activity_id", - otherKey: "member_student_id", - }); - Semester.belongsToMany(Club, { - as: "club_id_Clubs", - through: ActivitySign, - foreignKey: "semester_id", - otherKey: "club_id", - }); - Semester.belongsToMany(Club, { - as: "club_id_Club_SemesterClubs", - through: SemesterClub, - foreignKey: "semester_id", - otherKey: "club_id", - }); - Semester.belongsToMany(Member, { - as: "student_id_Member_MemberStatuses", - through: MemberStatus, - foreignKey: "semester_id", - otherKey: "student_id", - }); - ActivityFeedback.belongsTo(Activity, { - as: "activity_Activity", - foreignKey: "activity", - }); - Activity.hasMany(ActivityFeedback, { - as: "ActivityFeedbacks", - foreignKey: "activity", - }); - ActivityFeedbackExecutive.belongsTo(Activity, { - as: "activity_Activity", - foreignKey: "activity", - }); - Activity.hasOne(ActivityFeedbackExecutive, { - as: "ActivityFeedbackExecutive", - foreignKey: "activity", - }); - Activity.belongsTo(ActivityFeedbackType, { - as: "feedback_type_ActivityFeedbackType", - foreignKey: "feedback_type", - }); - ActivityFeedbackType.hasMany(Activity, { - as: "Activities", - foreignKey: "feedback_type", - }); - Activity_init.belongsTo(ActivityFeedbackType, { - as: "feedback_type_ActivityFeedbackType", - foreignKey: "feedback_type", - }); - ActivityFeedbackType.hasMany(Activity_init, { - as: "Activity_inits", - foreignKey: "feedback_type", - }); - Registration.belongsTo(ActivityFeedbackType, { - as: "feedback_type_ActivityFeedbackType", - foreignKey: "feedback_type", - }); - ActivityFeedbackType.hasMany(Registration, { - as: "Registrations", - foreignKey: "feedback_type", - }); - RegistrationActivity.belongsTo(ActivityFeedbackType, { - as: "feedback_type_ActivityFeedbackType", - foreignKey: "feedback_type", - }); - ActivityFeedbackType.hasMany(RegistrationActivity, { - as: "RegistrationActivities", - foreignKey: "feedback_type", - }); - Activity.belongsTo(ActivityType, { - as: "activity_type", - foreignKey: "activity_type_id", - }); - ActivityType.hasMany(Activity, { - as: "Activities", - foreignKey: "activity_type_id", - }); - Activity_init.belongsTo(ActivityType, { - as: "activity_type", - foreignKey: "activity_type_id", - }); - ActivityType.hasMany(Activity_init, { - as: "Activity_inits", - foreignKey: "activity_type_id", - }); - RegistrationActivity.belongsTo(ActivityType, { - as: "activity_type", - foreignKey: "activity_type_id", - }); - ActivityType.hasMany(RegistrationActivity, { - as: "RegistrationActivities", - foreignKey: "activity_type_id", - }); - Activity.belongsTo(Club, { as: "club", foreignKey: "club_id" }); - Club.hasMany(Activity, { as: "Activities", foreignKey: "club_id" }); - ActivitySign.belongsTo(Club, { as: "club", foreignKey: "club_id" }); - Club.hasMany(ActivitySign, { as: "ActivitySigns", foreignKey: "club_id" }); - Attendance.belongsTo(Club, { as: "fromClub", foreignKey: "fromClubId" }); - Club.hasMany(Attendance, { as: "Attendances", foreignKey: "fromClubId" }); - ClubRepresentative.belongsTo(Club, { as: "club", foreignKey: "club_id" }); - Club.hasMany(ClubRepresentative, { - as: "ClubRepresentatives", - foreignKey: "club_id", - }); - Funding.belongsTo(Club, { as: "club", foreignKey: "club_id" }); - Club.hasMany(Funding, { as: "Fundings", foreignKey: "club_id" }); - MemberClub.belongsTo(Club, { as: "club", foreignKey: "club_id" }); - Club.hasMany(MemberClub, { as: "MemberClubs", foreignKey: "club_id" }); - PermanentClub.belongsTo(Club, { as: "club", foreignKey: "club_id" }); - Club.hasOne(PermanentClub, { as: "PermanentClub", foreignKey: "club_id" }); - Registration.belongsTo(Club, { as: "club", foreignKey: "club_id" }); - Club.hasMany(Registration, { as: "Registrations", foreignKey: "club_id" }); - RegistrationActivity.belongsTo(Club, { as: "club", foreignKey: "club_id" }); - Club.hasMany(RegistrationActivity, { - as: "RegistrationActivities", - foreignKey: "club_id", - }); - SemesterClub.belongsTo(Club, { as: "club", foreignKey: "club_id" }); - Club.hasMany(SemesterClub, { as: "SemesterClubs", foreignKey: "club_id" }); - Warning.belongsTo(Club, { as: "club", foreignKey: "club_id" }); - Club.hasMany(Warning, { as: "Warnings", foreignKey: "club_id" }); - Club.belongsTo(ClubBuilding, { as: "building", foreignKey: "building_id" }); - ClubBuilding.hasMany(Club, { as: "Clubs", foreignKey: "building_id" }); - ClubRepresentative.belongsTo(ClubRepresentativeType, { - as: "type", - foreignKey: "type_id", - }); - ClubRepresentativeType.hasMany(ClubRepresentative, { - as: "ClubRepresentatives", - foreignKey: "type_id", - }); - Attendance.belongsTo(Division, { - as: "fromDivision", - foreignKey: "fromDivisionId", - }); - Division.hasMany(Attendance, { - as: "Attendances", - foreignKey: "fromDivisionId", - }); - Club.belongsTo(Division, { as: "division", foreignKey: "division_id" }); - Division.hasMany(Club, { as: "Clubs", foreignKey: "division_id" }); - Meeting.belongsTo(Division, { as: "division", foreignKey: "divisionId" }); - Division.hasMany(Meeting, { as: "Meetings", foreignKey: "divisionId" }); - Registration.belongsTo(Division, { - as: "division_Division", - foreignKey: "division", - }); - Division.hasMany(Registration, { - as: "Registrations", - foreignKey: "division", - }); - Division.belongsTo(DivisionGroup, { - as: "division_group", - foreignKey: "division_group_id", - }); - DivisionGroup.hasMany(Division, { - as: "Divisions", - foreignKey: "division_group_id", - }); - ExecutiveMember.belongsTo(ExecutiveBureau, { - as: "main_bureau_ExecutiveBureau", - foreignKey: "main_bureau", - }); - ExecutiveBureau.hasMany(ExecutiveMember, { - as: "ExecutiveMembers", - foreignKey: "main_bureau", - }); - ExecutiveMember.belongsTo(ExecutiveBureau, { - as: "sub_bureau_ExecutiveBureau", - foreignKey: "sub_bureau", - }); - ExecutiveBureau.hasMany(ExecutiveMember, { - as: "sub_bureau_ExecutiveMembers", - foreignKey: "sub_bureau", - }); - ActivityFeedbackExecutive.belongsTo(ExecutiveMember, { - as: "student", - foreignKey: "student_id", - }); - ExecutiveMember.hasMany(ActivityFeedbackExecutive, { - as: "ActivityFeedbackExecutives", - foreignKey: "student_id", - }); - ExecutiveMember.belongsTo(ExecutiveType, { - as: "type", - foreignKey: "type_id", - }); - ExecutiveType.hasMany(ExecutiveMember, { - as: "ExecutiveMembers", - foreignKey: "type_id", - }); - FundingEvidence.belongsTo(Funding, { - as: "funding", - foreignKey: "funding_id", - }); - Funding.hasMany(FundingEvidence, { - as: "FundingEvidences", - foreignKey: "funding_id", - }); - FundingFeedback.belongsTo(Funding, { - as: "funding_Funding", - foreignKey: "funding", - }); - Funding.hasMany(FundingFeedback, { - as: "FundingFeedbacks", - foreignKey: "funding", - }); - FundingFixture.belongsTo(Funding, { - as: "funding", - foreignKey: "funding_id", - }); - Funding.hasMany(FundingFixture, { - as: "FundingFixtures", - foreignKey: "funding_id", - }); - FundingNoncorp.belongsTo(Funding, { - as: "funding", - foreignKey: "funding_id", - }); - Funding.hasMany(FundingNoncorp, { - as: "FundingNoncorps", - foreignKey: "funding_id", - }); - FundingTransportation.belongsTo(Funding, { - as: "funding", - foreignKey: "funding_id", - }); - Funding.hasMany(FundingTransportation, { - as: "FundingTransportations", - foreignKey: "funding_id", - }); - FundingTransportationMember.belongsTo(Funding, { - as: "funding", - foreignKey: "funding_id", - }); - Funding.hasMany(FundingTransportationMember, { - as: "FundingTransportationMembers", - foreignKey: "funding_id", - }); - FundingEvidence.belongsTo(FundingEvidenceType, { - as: "funding_evidence_type", - foreignKey: "funding_evidence_type_id", - }); - FundingEvidenceType.hasMany(FundingEvidence, { - as: "FundingEvidences", - foreignKey: "funding_evidence_type_id", - }); - Funding.belongsTo(FundingFeedbackType, { - as: "funding_feedback_type_FundingFeedbackType", - foreignKey: "funding_feedback_type", - }); - FundingFeedbackType.hasMany(Funding, { - as: "Fundings", - foreignKey: "funding_feedback_type", - }); - FundingFixture.belongsTo(FundingFixtureObjectType, { - as: "fixture_type", - foreignKey: "fixture_type_id", - }); - FundingFixtureObjectType.hasMany(FundingFixture, { - as: "FundingFixtures", - foreignKey: "fixture_type_id", - }); - FundingFixture.belongsTo(FundingFixtureType, { - as: "funding_fixture_type", - foreignKey: "funding_fixture_type_id", - }); - FundingFixtureType.hasMany(FundingFixture, { - as: "FundingFixtures", - foreignKey: "funding_fixture_type_id", - }); - FundingTransportation.belongsTo(FundingTransportationType, { - as: "transportation_type", - foreignKey: "transportation_type_id", - }); - FundingTransportationType.hasMany(FundingTransportation, { - as: "FundingTransportations", - foreignKey: "transportation_type_id", - }); - Meeting.belongsTo(MeetingType, { as: "type", foreignKey: "type_id" }); - MeetingType.hasMany(Meeting, { as: "Meetings", foreignKey: "type_id" }); - ActivityFeedback.belongsTo(Member, { - as: "student", - foreignKey: "student_id", - }); - Member.hasMany(ActivityFeedback, { - as: "ActivityFeedbacks", - foreignKey: "student_id", - }); - ActivityMember.belongsTo(Member, { - as: "member_student", - foreignKey: "member_student_id", - }); - Member.hasMany(ActivityMember, { - as: "ActivityMembers", - foreignKey: "member_student_id", - }); - ActivityMember_init.belongsTo(Member, { - as: "member_student", - foreignKey: "member_student_id", - }); - Member.hasMany(ActivityMember_init, { - as: "ActivityMember_inits", - foreignKey: "member_student_id", - }); - ClubRepresentative.belongsTo(Member, { - as: "student", - foreignKey: "student_id", - }); - Member.hasMany(ClubRepresentative, { - as: "ClubRepresentatives", - foreignKey: "student_id", - }); - ExecutiveMember.belongsTo(Member, { - as: "student", - foreignKey: "student_id", - }); - Member.hasMany(ExecutiveMember, { - as: "ExecutiveMembers", - foreignKey: "student_id", - }); - Funding.belongsTo(Member, { - as: "funding_executive_Member", - foreignKey: "funding_executive", - }); - Member.hasMany(Funding, { as: "Fundings", foreignKey: "funding_executive" }); - FundingFeedback.belongsTo(Member, { - as: "student", - foreignKey: "student_id", - }); - Member.hasMany(FundingFeedback, { - as: "FundingFeedbacks", - foreignKey: "student_id", - }); - FundingTransportationMember.belongsTo(Member, { - as: "student", - foreignKey: "student_id", - }); - Member.hasMany(FundingTransportationMember, { - as: "FundingTransportationMembers", - foreignKey: "student_id", - }); - Meeting.belongsTo(Member, { as: "editor", foreignKey: "editorId" }); - Member.hasMany(Meeting, { as: "Meetings", foreignKey: "editorId" }); - MemberClub.belongsTo(Member, { as: "student", foreignKey: "student_id" }); - Member.hasMany(MemberClub, { as: "MemberClubs", foreignKey: "student_id" }); - MemberStatus.belongsTo(Member, { as: "student", foreignKey: "student_id" }); - Member.hasMany(MemberStatus, { - as: "MemberStatuses", - foreignKey: "student_id", - }); - Registration.belongsTo(Member, { as: "student", foreignKey: "student_id" }); - Member.hasMany(Registration, { - as: "Registrations", - foreignKey: "student_id", - }); - RegistrationActivityFeedback.belongsTo(Member, { - as: "student", - foreignKey: "student_id", - }); - Member.hasMany(RegistrationActivityFeedback, { - as: "RegistrationActivityFeedbacks", - foreignKey: "student_id", - }); - RegistrationActivityMember.belongsTo(Member, { - as: "member_student", - foreignKey: "member_student_id", - }); - Member.hasMany(RegistrationActivityMember, { - as: "RegistrationActivityMembers", - foreignKey: "member_student_id", - }); - RegistrationFeedback.belongsTo(Member, { - as: "student", - foreignKey: "student_id", - }); - Member.hasMany(RegistrationFeedback, { - as: "RegistrationFeedbacks", - foreignKey: "student_id", - }); - RegistrationMember.belongsTo(Member, { - as: "student", - foreignKey: "student_id", - }); - Member.hasMany(RegistrationMember, { - as: "RegistrationMembers", - foreignKey: "student_id", - }); - MemberClub.belongsTo(MemberStatus, { - as: "semester", - foreignKey: "semester_id", - }); - MemberStatus.hasMany(MemberClub, { - as: "MemberClubs", - foreignKey: "semester_id", - }); - MemberClub.belongsTo(Semester, { - as: "semesters", - foreignKey: "semester_id", - }); - Semester.hasMany(MemberClub, { - as: "MemberClubs", - foreignKey: "semester_id", - }); - RegistrationActivity.belongsTo(Registration, { - as: "registration_Registration", - foreignKey: "registration", - }); - Registration.hasMany(RegistrationActivity, { - as: "RegistrationActivities", - foreignKey: "registration", - }); - RegistrationEvidence.belongsTo(Registration, { - as: "registration", - foreignKey: "registration_id", - }); - Registration.hasMany(RegistrationEvidence, { - as: "RegistrationEvidences", - foreignKey: "registration_id", - }); - RegistrationFeedback.belongsTo(Registration, { - as: "registration_Registration", - foreignKey: "registration", - }); - Registration.hasMany(RegistrationFeedback, { - as: "RegistrationFeedbacks", - foreignKey: "registration", - }); - RegistrationSign.belongsTo(Registration, { - as: "registration_Registration", - foreignKey: "registration", - }); - Registration.hasMany(RegistrationSign, { - as: "RegistrationSigns", - foreignKey: "registration", - }); - RegistrationActivityEvidence.belongsTo(RegistrationActivity, { - as: "activity", - foreignKey: "activity_id", - }); - RegistrationActivity.hasMany(RegistrationActivityEvidence, { - as: "RegistrationActivityEvidences", - foreignKey: "activity_id", - }); - RegistrationActivityFeedback.belongsTo(RegistrationActivity, { - as: "activity_RegistrationActivity", - foreignKey: "activity", - }); - RegistrationActivity.hasMany(RegistrationActivityFeedback, { - as: "RegistrationActivityFeedbacks", - foreignKey: "activity", - }); - RegistrationActivityMember.belongsTo(RegistrationActivity, { - as: "activity", - foreignKey: "activity_id", - }); - RegistrationActivity.hasMany(RegistrationActivityMember, { - as: "RegistrationActivityMembers", - foreignKey: "activity_id", - }); - RegistrationEvidence.belongsTo(RegistrationEvidenceType, { - as: "registration_evidence_type_RegistrationEvidenceType", - foreignKey: "registration_evidence_type", - }); - RegistrationEvidenceType.hasMany(RegistrationEvidence, { - as: "RegistrationEvidences", - foreignKey: "registration_evidence_type", - }); - RegistrationSign.belongsTo(RegistrationSignType, { - as: "sign_type_RegistrationSignType", - foreignKey: "sign_type", - }); - RegistrationSignType.hasMany(RegistrationSign, { - as: "RegistrationSigns", - foreignKey: "sign_type", - }); - Registration.belongsTo(RegistrationType, { - as: "type", - foreignKey: "type_id", - }); - RegistrationType.hasMany(Registration, { - as: "Registrations", - foreignKey: "type_id", - }); - ActivitySign.belongsTo(Semester, { - as: "semester", - foreignKey: "semester_id", - }); - Semester.hasMany(ActivitySign, { - as: "ActivitySigns", - foreignKey: "semester_id", - }); - Duration.belongsTo(Semester, { as: "semester", foreignKey: "semester_id" }); - Semester.hasMany(Duration, { as: "Durations", foreignKey: "semester_id" }); - MemberStatus.belongsTo(Semester, { - as: "semester", - foreignKey: "semester_id", - }); - Semester.hasMany(MemberStatus, { - as: "MemberStatuses", - foreignKey: "semester_id", - }); - Registration.belongsTo(Semester, { - as: "semester", - foreignKey: "semester_id", - }); - Semester.hasMany(Registration, { - as: "Registrations", - foreignKey: "semester_id", - }); - RegistrationActivity.belongsTo(Semester, { - as: "semester", - foreignKey: "semester_id", - }); - Semester.hasMany(RegistrationActivity, { - as: "RegistrationActivities", - foreignKey: "semester_id", - }); - RegistrationMember.belongsTo(Semester, { - as: "semester", - foreignKey: "semester_id", - }); - Semester.hasMany(RegistrationMember, { - as: "RegistrationMembers", - foreignKey: "semester_id", - }); - SemesterClub.belongsTo(Semester, { - as: "semester", - foreignKey: "semester_id", - }); - Semester.hasMany(SemesterClub, { - as: "SemesterClubs", - foreignKey: "semester_id", - }); - RegistrationMember.belongsTo(SemesterClub, { - as: "club", - foreignKey: "club_id", - }); - SemesterClub.hasMany(RegistrationMember, { - as: "RegistrationMembers", - foreignKey: "club_id", - }); - SemesterClub.belongsTo(SemesterClubType, { - as: "type", - foreignKey: "type_id", - }); - SemesterClubType.hasMany(SemesterClub, { - as: "SemesterClubs", - foreignKey: "type_id", - }); + Club.belongsToMany(Semester, { as: 'semester_id_Semesters', through: ActivitySign, foreignKey: "club_id", otherKey: "semester_id" }); + Club.belongsToMany(Semester, { as: 'semester_id_Semester_SemesterClubs', through: SemesterClub, foreignKey: "club_id", otherKey: "semester_id" }); + Funding.belongsToMany(Member, { as: 'student_id_Members', through: FundingTransportationMember, foreignKey: "funding_id", otherKey: "student_id" }); + Member.belongsToMany(Funding, { as: 'funding_id_Fundings', through: FundingTransportationMember, foreignKey: "student_id", otherKey: "funding_id" }); + Member.belongsToMany(RegistrationActivity, { as: 'activity_id_RegistrationActivities', through: RegistrationActivityMember, foreignKey: "member_student_id", otherKey: "activity_id" }); + Member.belongsToMany(Semester, { as: 'semester_id_Semester_MemberStatuses', through: MemberStatus, foreignKey: "student_id", otherKey: "semester_id" }); + RegistrationActivity.belongsToMany(Member, { as: 'member_student_id_Members', through: RegistrationActivityMember, foreignKey: "activity_id", otherKey: "member_student_id" }); + Semester.belongsToMany(Club, { as: 'club_id_Clubs', through: ActivitySign, foreignKey: "semester_id", otherKey: "club_id" }); + Semester.belongsToMany(Club, { as: 'club_id_Club_SemesterClubs', through: SemesterClub, foreignKey: "semester_id", otherKey: "club_id" }); + Semester.belongsToMany(Member, { as: 'student_id_Member_MemberStatuses', through: MemberStatus, foreignKey: "semester_id", otherKey: "student_id" }); + ActivityFeedback.belongsTo(Activity, { as: "activity_Activity", foreignKey: "activity"}); + Activity.hasMany(ActivityFeedback, { as: "ActivityFeedbacks", foreignKey: "activity"}); + ActivityFeedbackExecutive.belongsTo(Activity, { as: "activity_Activity", foreignKey: "activity"}); + Activity.hasOne(ActivityFeedbackExecutive, { as: "ActivityFeedbackExecutive", foreignKey: "activity"}); + Activity.belongsTo(ActivityFeedbackType, { as: "feedback_type_ActivityFeedbackType", foreignKey: "feedback_type"}); + ActivityFeedbackType.hasMany(Activity, { as: "Activities", foreignKey: "feedback_type"}); + Activity_init.belongsTo(ActivityFeedbackType, { as: "feedback_type_ActivityFeedbackType", foreignKey: "feedback_type"}); + ActivityFeedbackType.hasMany(Activity_init, { as: "Activity_inits", foreignKey: "feedback_type"}); + Registration.belongsTo(ActivityFeedbackType, { as: "feedback_type_ActivityFeedbackType", foreignKey: "feedback_type"}); + ActivityFeedbackType.hasMany(Registration, { as: "Registrations", foreignKey: "feedback_type"}); + RegistrationActivity.belongsTo(ActivityFeedbackType, { as: "feedback_type_ActivityFeedbackType", foreignKey: "feedback_type"}); + ActivityFeedbackType.hasMany(RegistrationActivity, { as: "RegistrationActivities", foreignKey: "feedback_type"}); + Activity.belongsTo(ActivityType, { as: "activity_type", foreignKey: "activity_type_id"}); + ActivityType.hasMany(Activity, { as: "Activities", foreignKey: "activity_type_id"}); + Activity_init.belongsTo(ActivityType, { as: "activity_type", foreignKey: "activity_type_id"}); + ActivityType.hasMany(Activity_init, { as: "Activity_inits", foreignKey: "activity_type_id"}); + RegistrationActivity.belongsTo(ActivityType, { as: "activity_type", foreignKey: "activity_type_id"}); + ActivityType.hasMany(RegistrationActivity, { as: "RegistrationActivities", foreignKey: "activity_type_id"}); + Activity.belongsTo(Club, { as: "club", foreignKey: "club_id"}); + Club.hasMany(Activity, { as: "Activities", foreignKey: "club_id"}); + ActivitySign.belongsTo(Club, { as: "club", foreignKey: "club_id"}); + Club.hasMany(ActivitySign, { as: "ActivitySigns", foreignKey: "club_id"}); + Attendance.belongsTo(Club, { as: "fromClub", foreignKey: "fromClubId"}); + Club.hasMany(Attendance, { as: "Attendances", foreignKey: "fromClubId"}); + ClubRepresentative.belongsTo(Club, { as: "club", foreignKey: "club_id"}); + Club.hasMany(ClubRepresentative, { as: "ClubRepresentatives", foreignKey: "club_id"}); + Funding.belongsTo(Club, { as: "club", foreignKey: "club_id"}); + Club.hasMany(Funding, { as: "Fundings", foreignKey: "club_id"}); + MemberClub.belongsTo(Club, { as: "club", foreignKey: "club_id"}); + Club.hasMany(MemberClub, { as: "MemberClubs", foreignKey: "club_id"}); + PermanentClub.belongsTo(Club, { as: "club", foreignKey: "club_id"}); + Club.hasOne(PermanentClub, { as: "PermanentClub", foreignKey: "club_id"}); + Registration.belongsTo(Club, { as: "club", foreignKey: "club_id"}); + Club.hasMany(Registration, { as: "Registrations", foreignKey: "club_id"}); + RegistrationActivity.belongsTo(Club, { as: "club", foreignKey: "club_id"}); + Club.hasMany(RegistrationActivity, { as: "RegistrationActivities", foreignKey: "club_id"}); + SemesterClub.belongsTo(Club, { as: "club", foreignKey: "club_id"}); + Club.hasMany(SemesterClub, { as: "SemesterClubs", foreignKey: "club_id"}); + Warning.belongsTo(Club, { as: "club", foreignKey: "club_id"}); + Club.hasMany(Warning, { as: "Warnings", foreignKey: "club_id"}); + Club.belongsTo(ClubBuilding, { as: "building", foreignKey: "building_id"}); + ClubBuilding.hasMany(Club, { as: "Clubs", foreignKey: "building_id"}); + ClubRepresentative.belongsTo(ClubRepresentativeType, { as: "type", foreignKey: "type_id"}); + ClubRepresentativeType.hasMany(ClubRepresentative, { as: "ClubRepresentatives", foreignKey: "type_id"}); + Attendance.belongsTo(Division, { as: "fromDivision", foreignKey: "fromDivisionId"}); + Division.hasMany(Attendance, { as: "Attendances", foreignKey: "fromDivisionId"}); + Club.belongsTo(Division, { as: "division", foreignKey: "division_id"}); + Division.hasMany(Club, { as: "Clubs", foreignKey: "division_id"}); + Meeting.belongsTo(Division, { as: "division", foreignKey: "divisionId"}); + Division.hasMany(Meeting, { as: "Meetings", foreignKey: "divisionId"}); + Registration.belongsTo(Division, { as: "division_Division", foreignKey: "division"}); + Division.hasMany(Registration, { as: "Registrations", foreignKey: "division"}); + Division.belongsTo(DivisionGroup, { as: "division_group", foreignKey: "division_group_id"}); + DivisionGroup.hasMany(Division, { as: "Divisions", foreignKey: "division_group_id"}); + ExecutiveMember.belongsTo(ExecutiveBureau, { as: "main_bureau_ExecutiveBureau", foreignKey: "main_bureau"}); + ExecutiveBureau.hasMany(ExecutiveMember, { as: "ExecutiveMembers", foreignKey: "main_bureau"}); + ExecutiveMember.belongsTo(ExecutiveBureau, { as: "sub_bureau_ExecutiveBureau", foreignKey: "sub_bureau"}); + ExecutiveBureau.hasMany(ExecutiveMember, { as: "sub_bureau_ExecutiveMembers", foreignKey: "sub_bureau"}); + ActivityFeedbackExecutive.belongsTo(ExecutiveMember, { as: "student", foreignKey: "student_id"}); + ExecutiveMember.hasMany(ActivityFeedbackExecutive, { as: "ActivityFeedbackExecutives", foreignKey: "student_id"}); + ExecutiveMember.belongsTo(ExecutiveType, { as: "type", foreignKey: "type_id"}); + ExecutiveType.hasMany(ExecutiveMember, { as: "ExecutiveMembers", foreignKey: "type_id"}); + FundingEvidence.belongsTo(Funding, { as: "funding", foreignKey: "funding_id"}); + Funding.hasMany(FundingEvidence, { as: "FundingEvidences", foreignKey: "funding_id"}); + FundingFeedback.belongsTo(Funding, { as: "funding_Funding", foreignKey: "funding"}); + Funding.hasMany(FundingFeedback, { as: "FundingFeedbacks", foreignKey: "funding"}); + FundingFixture.belongsTo(Funding, { as: "funding", foreignKey: "funding_id"}); + Funding.hasMany(FundingFixture, { as: "FundingFixtures", foreignKey: "funding_id"}); + FundingNoncorp.belongsTo(Funding, { as: "funding", foreignKey: "funding_id"}); + Funding.hasMany(FundingNoncorp, { as: "FundingNoncorps", foreignKey: "funding_id"}); + FundingTransportation.belongsTo(Funding, { as: "funding", foreignKey: "funding_id"}); + Funding.hasMany(FundingTransportation, { as: "FundingTransportations", foreignKey: "funding_id"}); + FundingTransportationMember.belongsTo(Funding, { as: "funding", foreignKey: "funding_id"}); + Funding.hasMany(FundingTransportationMember, { as: "FundingTransportationMembers", foreignKey: "funding_id"}); + FundingEvidence.belongsTo(FundingEvidenceType, { as: "funding_evidence_type", foreignKey: "funding_evidence_type_id"}); + FundingEvidenceType.hasMany(FundingEvidence, { as: "FundingEvidences", foreignKey: "funding_evidence_type_id"}); + Funding.belongsTo(FundingFeedbackType, { as: "funding_feedback_type_FundingFeedbackType", foreignKey: "funding_feedback_type"}); + FundingFeedbackType.hasMany(Funding, { as: "Fundings", foreignKey: "funding_feedback_type"}); + FundingFixture.belongsTo(FundingFixtureObjectType, { as: "fixture_type", foreignKey: "fixture_type_id"}); + FundingFixtureObjectType.hasMany(FundingFixture, { as: "FundingFixtures", foreignKey: "fixture_type_id"}); + FundingFixture.belongsTo(FundingFixtureType, { as: "funding_fixture_type", foreignKey: "funding_fixture_type_id"}); + FundingFixtureType.hasMany(FundingFixture, { as: "FundingFixtures", foreignKey: "funding_fixture_type_id"}); + FundingTransportation.belongsTo(FundingTransportationType, { as: "transportation_type", foreignKey: "transportation_type_id"}); + FundingTransportationType.hasMany(FundingTransportation, { as: "FundingTransportations", foreignKey: "transportation_type_id"}); + Meeting.belongsTo(MeetingType, { as: "type", foreignKey: "type_id"}); + MeetingType.hasMany(Meeting, { as: "Meetings", foreignKey: "type_id"}); + ActivityFeedback.belongsTo(Member, { as: "student", foreignKey: "student_id"}); + Member.hasMany(ActivityFeedback, { as: "ActivityFeedbacks", foreignKey: "student_id"}); + ActivityMember.belongsTo(Member, { as: "member_student", foreignKey: "member_student_id"}); + Member.hasMany(ActivityMember, { as: "ActivityMembers", foreignKey: "member_student_id"}); + ActivityMember_init.belongsTo(Member, { as: "member_student", foreignKey: "member_student_id"}); + Member.hasMany(ActivityMember_init, { as: "ActivityMember_inits", foreignKey: "member_student_id"}); + ClubRepresentative.belongsTo(Member, { as: "student", foreignKey: "student_id"}); + Member.hasMany(ClubRepresentative, { as: "ClubRepresentatives", foreignKey: "student_id"}); + ExecutiveMember.belongsTo(Member, { as: "student", foreignKey: "student_id"}); + Member.hasMany(ExecutiveMember, { as: "ExecutiveMembers", foreignKey: "student_id"}); + Funding.belongsTo(Member, { as: "funding_executive_Member", foreignKey: "funding_executive"}); + Member.hasMany(Funding, { as: "Fundings", foreignKey: "funding_executive"}); + FundingFeedback.belongsTo(Member, { as: "student", foreignKey: "student_id"}); + Member.hasMany(FundingFeedback, { as: "FundingFeedbacks", foreignKey: "student_id"}); + FundingTransportationMember.belongsTo(Member, { as: "student", foreignKey: "student_id"}); + Member.hasMany(FundingTransportationMember, { as: "FundingTransportationMembers", foreignKey: "student_id"}); + Meeting.belongsTo(Member, { as: "editor", foreignKey: "editorId"}); + Member.hasMany(Meeting, { as: "Meetings", foreignKey: "editorId"}); + MemberClub.belongsTo(Member, { as: "student", foreignKey: "student_id"}); + Member.hasMany(MemberClub, { as: "MemberClubs", foreignKey: "student_id"}); + MemberStatus.belongsTo(Member, { as: "student", foreignKey: "student_id"}); + Member.hasMany(MemberStatus, { as: "MemberStatuses", foreignKey: "student_id"}); + Registration.belongsTo(Member, { as: "student", foreignKey: "student_id"}); + Member.hasMany(Registration, { as: "Registrations", foreignKey: "student_id"}); + RegistrationActivityFeedback.belongsTo(Member, { as: "student", foreignKey: "student_id"}); + Member.hasMany(RegistrationActivityFeedback, { as: "RegistrationActivityFeedbacks", foreignKey: "student_id"}); + RegistrationActivityMember.belongsTo(Member, { as: "member_student", foreignKey: "member_student_id"}); + Member.hasMany(RegistrationActivityMember, { as: "RegistrationActivityMembers", foreignKey: "member_student_id"}); + RegistrationFeedback.belongsTo(Member, { as: "student", foreignKey: "student_id"}); + Member.hasMany(RegistrationFeedback, { as: "RegistrationFeedbacks", foreignKey: "student_id"}); + RegistrationMember.belongsTo(Member, { as: "student", foreignKey: "student_id"}); + Member.hasMany(RegistrationMember, { as: "RegistrationMembers", foreignKey: "student_id"}); + MemberClub.belongsTo(MemberStatus, { as: "semester", foreignKey: "semester_id"}); + MemberStatus.hasMany(MemberClub, { as: "MemberClubs", foreignKey: "semester_id"}); + RegistrationActivity.belongsTo(Registration, { as: "registration_Registration", foreignKey: "registration"}); + Registration.hasMany(RegistrationActivity, { as: "RegistrationActivities", foreignKey: "registration"}); + RegistrationEvidence.belongsTo(Registration, { as: "registration", foreignKey: "registration_id"}); + Registration.hasMany(RegistrationEvidence, { as: "RegistrationEvidences", foreignKey: "registration_id"}); + RegistrationFeedback.belongsTo(Registration, { as: "registration_Registration", foreignKey: "registration"}); + Registration.hasMany(RegistrationFeedback, { as: "RegistrationFeedbacks", foreignKey: "registration"}); + RegistrationSign.belongsTo(Registration, { as: "registration_Registration", foreignKey: "registration"}); + Registration.hasMany(RegistrationSign, { as: "RegistrationSigns", foreignKey: "registration"}); + RegistrationActivityEvidence.belongsTo(RegistrationActivity, { as: "activity", foreignKey: "activity_id"}); + RegistrationActivity.hasMany(RegistrationActivityEvidence, { as: "RegistrationActivityEvidences", foreignKey: "activity_id"}); + RegistrationActivityFeedback.belongsTo(RegistrationActivity, { as: "activity_RegistrationActivity", foreignKey: "activity"}); + RegistrationActivity.hasMany(RegistrationActivityFeedback, { as: "RegistrationActivityFeedbacks", foreignKey: "activity"}); + RegistrationActivityMember.belongsTo(RegistrationActivity, { as: "activity", foreignKey: "activity_id"}); + RegistrationActivity.hasMany(RegistrationActivityMember, { as: "RegistrationActivityMembers", foreignKey: "activity_id"}); + RegistrationEvidence.belongsTo(RegistrationEvidenceType, { as: "registration_evidence_type_RegistrationEvidenceType", foreignKey: "registration_evidence_type"}); + RegistrationEvidenceType.hasMany(RegistrationEvidence, { as: "RegistrationEvidences", foreignKey: "registration_evidence_type"}); + RegistrationSign.belongsTo(RegistrationSignType, { as: "sign_type_RegistrationSignType", foreignKey: "sign_type"}); + RegistrationSignType.hasMany(RegistrationSign, { as: "RegistrationSigns", foreignKey: "sign_type"}); + Registration.belongsTo(RegistrationType, { as: "type", foreignKey: "type_id"}); + RegistrationType.hasMany(Registration, { as: "Registrations", foreignKey: "type_id"}); + ActivitySign.belongsTo(Semester, { as: "semester", foreignKey: "semester_id"}); + Semester.hasMany(ActivitySign, { as: "ActivitySigns", foreignKey: "semester_id"}); + Duration.belongsTo(Semester, { as: "semester", foreignKey: "semester_id"}); + Semester.hasMany(Duration, { as: "Durations", foreignKey: "semester_id"}); + MemberStatus.belongsTo(Semester, { as: "semester", foreignKey: "semester_id"}); + Semester.hasMany(MemberStatus, { as: "MemberStatuses", foreignKey: "semester_id"}); + Registration.belongsTo(Semester, { as: "semester", foreignKey: "semester_id"}); + Semester.hasMany(Registration, { as: "Registrations", foreignKey: "semester_id"}); + RegistrationActivity.belongsTo(Semester, { as: "semester", foreignKey: "semester_id"}); + Semester.hasMany(RegistrationActivity, { as: "RegistrationActivities", foreignKey: "semester_id"}); + RegistrationMember.belongsTo(Semester, { as: "semester", foreignKey: "semester_id"}); + Semester.hasMany(RegistrationMember, { as: "RegistrationMembers", foreignKey: "semester_id"}); + SemesterClub.belongsTo(Semester, { as: "semester", foreignKey: "semester_id"}); + Semester.hasMany(SemesterClub, { as: "SemesterClubs", foreignKey: "semester_id"}); + RegistrationMember.belongsTo(SemesterClub, { as: "club", foreignKey: "club_id"}); + SemesterClub.hasMany(RegistrationMember, { as: "RegistrationMembers", foreignKey: "club_id"}); + SemesterClub.belongsTo(SemesterClubType, { as: "type", foreignKey: "type_id"}); + SemesterClubType.hasMany(SemesterClub, { as: "SemesterClubs", foreignKey: "type_id"}); return { Activity, diff --git a/back/routes/new/clubs.js b/back/routes/new/clubs.js index 4fab746..2d934f8 100644 --- a/back/routes/new/clubs.js +++ b/back/routes/new/clubs.js @@ -250,6 +250,7 @@ router.get("/club/:id", async (req, res) => { representative: clubPresident, advisor: semesterClubInfo ? semesterClubInfo.advisor : null, totalMembers: totalMembersCount, + description: club.description, divisionName: club.division.name, foundingYear: club.founding_year, room: roomLocation,