diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-09 15:31:30 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-09 15:31:30 +0200 |
| commit | f950bbfcde927ebff3d6a7c341851d6e4c34924b (patch) | |
| tree | 90f4417fd3dcb0cc6bc7bdb2de42ed1ef5c2c244 | |
| parent | 8265e92db6dd52e211bac01d7b2eac55d319e734 (diff) | |
| download | orm-f950bbfcde927ebff3d6a7c341851d6e4c34924b.tar.gz orm-f950bbfcde927ebff3d6a7c341851d6e4c34924b.zip | |
add associations for stats
| -rw-r--r-- | model.js | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -15,23 +15,36 @@ module.exports = (seq, Seq) => { Series = seq.import("./models/series.js"), GameMode = seq.import("./models/game_mode.js"), Role = seq.import("./models/role.js"), + Filter = seq.import("./models/filter.js"), // Telemetry ItemParticipant = seq.import("./models/item_participant.js"), // data stats - ParticipantStats = seq.import("./models/participant_stats.js"); + ParticipantStats = seq.import("./models/participant_stats.js"), + + // stats aggregations + PlayerPoint = seq.import("./models/player_point.js"), + GlobalPoint = seq.import("./models/global_point.js"); Roster.belongsTo(Match, { foreignKey: "match_api_id", targetKey: "api_id" }); Participant.belongsTo(Roster, { foreignKey: "roster_api_id", targetKey: "api_id" }); Participant.hasMany(ItemParticipant, { as: "items", foreignKey: "participant_api_id", sourceKey: "api_id" }); + Participant.hasMany(ParticipantStats, { as: "participant_stats", foreignKey: "participant_api_id", sourceKey: "api_id" }); + Participant.belongsTo(GameMode, { foreignKey: "game_mode_id" }); + Participant.belongsTo(Hero, { foreignKey: "hero_id" }); + Participant.belongsTo(Series, { foreignKey: "series_id" }); + Participant.belongsTo(Role, { foreignKey: "role_id" }); + Participant.belongsTo(Filter, { foreignKey: "filter_id" }); + ParticipantStats.belongsTo(Participant, { foreignKey: "participant_api_id", "targetKey": "api_id" }); ItemParticipant.belongsTo(Item, { foreignKey: "item_id", targetKey: "id" }); return { Match, Roster, Participant, Player, Asset, - Item, Hero, Series, GameMode, Role, + Item, Hero, Series, GameMode, Role, Filter, ItemParticipant, - ParticipantStats + ParticipantStats, + PlayerPoint, GlobalPoint }; }; |
