update
This commit is contained in:
@@ -32,6 +32,20 @@ const Game = require('./Game');
|
||||
const LessonComponentProgress = require('./LessonComponentProgress');
|
||||
const LessonLeaderboard = require('./LessonLeaderboard');
|
||||
|
||||
// Group 3.2: Vocabulary System (NEW)
|
||||
const Vocab = require('./Vocab');
|
||||
const VocabMapping = require('./VocabMapping');
|
||||
const VocabForm = require('./VocabForm');
|
||||
const VocabRelation = require('./VocabRelation');
|
||||
|
||||
// Group 3.3: Grammar System (NEW)
|
||||
const Grammar = require('./Grammar');
|
||||
const GrammarMapping = require('./GrammarMapping');
|
||||
const GrammarMediaStory = require('./GrammarMediaStory');
|
||||
|
||||
// Group 3.4: Story System (NEW)
|
||||
const Story = require('./Story');
|
||||
|
||||
// Group 4: Attendance
|
||||
const AttendanceLog = require('./AttendanceLog');
|
||||
const AttendanceDaily = require('./AttendanceDaily');
|
||||
@@ -148,6 +162,29 @@ const setupRelationships = () => {
|
||||
LessonLeaderboard.belongsTo(UsersAuth, { foreignKey: 'user_id', as: 'user' });
|
||||
Lesson.hasMany(LessonLeaderboard, { foreignKey: 'lesson_id', as: 'leaderboard' });
|
||||
|
||||
// Vocabulary relationships (NEW)
|
||||
// Vocab -> VocabMapping (1:N)
|
||||
Vocab.hasMany(VocabMapping, { foreignKey: 'vocab_id', as: 'mappings' });
|
||||
VocabMapping.belongsTo(Vocab, { foreignKey: 'vocab_id', as: 'vocab' });
|
||||
|
||||
// Vocab -> VocabForm (1:N)
|
||||
Vocab.hasMany(VocabForm, { foreignKey: 'vocab_id', as: 'forms' });
|
||||
VocabForm.belongsTo(Vocab, { foreignKey: 'vocab_id', as: 'vocab' });
|
||||
|
||||
// Vocab -> VocabRelation (1:N)
|
||||
Vocab.hasMany(VocabRelation, { foreignKey: 'vocab_id', as: 'relations' });
|
||||
VocabRelation.belongsTo(Vocab, { foreignKey: 'vocab_id', as: 'vocab' });
|
||||
VocabRelation.belongsTo(Vocab, { foreignKey: 'related_vocab_id', as: 'relatedVocab' });
|
||||
|
||||
// Grammar relationships (NEW)
|
||||
// Grammar -> GrammarMapping (1:N)
|
||||
Grammar.hasMany(GrammarMapping, { foreignKey: 'grammar_id', as: 'mappings' });
|
||||
GrammarMapping.belongsTo(Grammar, { foreignKey: 'grammar_id', as: 'grammar' });
|
||||
|
||||
// Grammar -> GrammarMediaStory (1:N)
|
||||
Grammar.hasMany(GrammarMediaStory, { foreignKey: 'grammar_id', as: 'mediaStories' });
|
||||
GrammarMediaStory.belongsTo(Grammar, { foreignKey: 'grammar_id', as: 'grammar' });
|
||||
|
||||
// Attendance relationships
|
||||
AttendanceLog.belongsTo(UsersAuth, { foreignKey: 'user_id', as: 'user' });
|
||||
AttendanceLog.belongsTo(School, { foreignKey: 'school_id', as: 'school' });
|
||||
@@ -258,6 +295,20 @@ module.exports = {
|
||||
LessonComponentProgress,
|
||||
LessonLeaderboard,
|
||||
|
||||
// Group 3.2: Vocabulary System (NEW)
|
||||
Vocab,
|
||||
VocabMapping,
|
||||
VocabForm,
|
||||
VocabRelation,
|
||||
|
||||
// Group 3.3: Grammar System (NEW)
|
||||
Grammar,
|
||||
GrammarMapping,
|
||||
GrammarMediaStory,
|
||||
|
||||
// Group 3.4: Story System (NEW)
|
||||
Story,
|
||||
|
||||
// Group 4: Attendance
|
||||
AttendanceLog,
|
||||
AttendanceDaily,
|
||||
|
||||
Reference in New Issue
Block a user