From 79b928c775fb11c65e9b9010d6e8268e9f151296 Mon Sep 17 00:00:00 2001 From: Evan Powell Date: Sat, 7 Nov 2020 19:49:32 -0600 Subject: [PATCH] Added more Comments to the front end stuff --- app/FrontendUnit.js | 10 ++++++++++ app/GenerateMatchupsForWeek.patch.js | 8 ++++++++ app/GenerateWeeklyResults.patch.js | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/app/FrontendUnit.js b/app/FrontendUnit.js index 31ab1e3..79c8734 100644 --- a/app/FrontendUnit.js +++ b/app/FrontendUnit.js @@ -2,6 +2,11 @@ const Unit = require('libflitter/Unit') const Express = require('express') const path = require('path') +/** + * FrontendUnit + * @extends Unit + * ---------------------------------------------------------------------------------------- + */ class FrontendUnit extends Unit { static get services() { return [...super.services, 'configs', 'express', 'canon', 'utility', 'models'] @@ -17,6 +22,11 @@ class FrontendUnit extends Unit { this.directory = this.utility.path(this.configs.get('server.frontend_path')) } + /** + * + * @param app + * + */ async go(app) { app.express.use('/app', [ this.canon.get('middleware::auth:UserOnly'), diff --git a/app/GenerateMatchupsForWeek.patch.js b/app/GenerateMatchupsForWeek.patch.js index 5ec24c7..d7ef265 100644 --- a/app/GenerateMatchupsForWeek.patch.js +++ b/app/GenerateMatchupsForWeek.patch.js @@ -17,6 +17,9 @@ class GenerateMatchupsForWeekPatch extends Injectable { return [...super.services, 'models', 'sports_data', 'output'] } + /** + * + */ async run() { const Team = this.models.get('Team') const Matchup = this.models.get('Matchup') @@ -112,6 +115,11 @@ class GenerateMatchupsForWeekPatch extends Injectable { this.output.success('Complete.') } + /** + * + * @param team + * @returns data to represent what teams have been played by the param team + */ async get_teams_played_by_team(team) { const Matchup = this.models.get('Matchup') const home_games = await Matchup.find({ home_team_id: team.id }) diff --git a/app/GenerateWeeklyResults.patch.js b/app/GenerateWeeklyResults.patch.js index 8f6529f..c829ae5 100644 --- a/app/GenerateWeeklyResults.patch.js +++ b/app/GenerateWeeklyResults.patch.js @@ -1,10 +1,19 @@ const { Injectable } = require('flitter-di') +/** + * GenerateWeeklyResultsPatch + * @extends Injectable + * ---------------------------------------------------------------------------- + */ class GenerateWeeklyResultsPatch extends Injectable { static get services() { return [...super.services, 'models', 'sports_data'] } + /** + * Runs the patch + * @returns {Promise} + */ async run() { const Matchup = this.models.get('Matchup') const current_week = await this.sports_data.current_play_week()