1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/* jshint esnext:true */
'use strict';
module.exports = (seq, Seq) => {
let Match = seq.import("./models/match.js"),
Asset = seq.import("./models/asset.js"),
Roster = seq.import("./models/roster.js"),
//Team = seq.import("./models/team.js"),
Participant = seq.import("./models/participant.js"),
ParticipantExt = seq.import("./models/participant_ext.js"),
ParticipantItemUse = seq.import("./models/participant_item_use.js"),
Player = seq.import("./models/player.js"),
PlayerExt = seq.import("./models/player_ext.js"),
Item = seq.import("./models/item.js");
Match.hasMany(Asset, {as: "Assets"});
Asset.belongsTo(Match);
Roster.belongsTo(Match, { foreignKey: "match_api_id", targetKey: "api_id" });
//Roster.hasOne(Team, {as: "Team"});
//Team.belongsTo(Roster);
Participant.belongsTo(Roster, { foreignKey: "roster_api_id", targetKey: "api_id" });
Participant.hasOne(Player, { foreignKey: "player_api_id", targetKey: "api_id" });
ParticipantItemUse.belongsTo(Participant, { foreignKey: "participant_api_id", targetKey: "api_id" });
ParticipantItemUse.hasOne(Item);
ParticipantExt.belongsTo(Participant, { foreignKey: "participant_api_id", targetKey: "api_id" });
PlayerExt.belongsTo(Player, { foreignKey: "player_api_id", targetKey: "api_id" });
//return {Match, Roster, Team, Participant, Player, Asset};
return {Match, Roster, Participant, ParticipantExt, ParticipantItemUse, Player, PlayerExt, Asset, Item};
};
|