Added more Comments to the front end stuff

This commit is contained in:
Evan Powell 2020-11-07 19:49:32 -06:00
parent 2241779f5d
commit 79b928c775
3 changed files with 27 additions and 0 deletions

View File

@ -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'),

View File

@ -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 })

View File

@ -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<void>}
*/
async run() {
const Matchup = this.models.get('Matchup')
const current_week = await this.sports_data.current_play_week()