Comment all the things!
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
*
|
||||
* Route-specific middleware should be specified in the corresponding
|
||||
* routes file.
|
||||
*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
const Middleware = [
|
||||
"auth:Utility",
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
const { Middleware } = require('libflitter')
|
||||
|
||||
/*
|
||||
/**
|
||||
* InjectUserTeam Middleware
|
||||
* -------------------------------------------------------------
|
||||
* For the authenticated user, looks up the associated Team instance
|
||||
* and injects it as request.team.
|
||||
* and injects it as request.user_team.
|
||||
*
|
||||
* @extends Middleware
|
||||
*/
|
||||
class InjectUserTeam extends Middleware {
|
||||
static get services() {
|
||||
return [...super.services, 'models']
|
||||
}
|
||||
|
||||
/*
|
||||
* Run the middleware test.
|
||||
/**
|
||||
* Inject the user's team into the request, or redirect to a login page.
|
||||
* @param req
|
||||
* @param res
|
||||
* @param next
|
||||
* @param [args = {}]
|
||||
*/
|
||||
async test(req, res, next, args = {}){
|
||||
if ( !req.user ) return res.redirect('/auth/login')
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
* Allows the request to proceed unless there's an authenticated user
|
||||
* in the session. If so, redirect to the auth flow destination if one
|
||||
* exists. If not, redirect to the default login route.
|
||||
*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
const Middleware = require('flitter-auth/middleware/GuestOnly')
|
||||
class GuestOnly extends Middleware {
|
||||
|
||||
@@ -4,6 +4,8 @@ const Middleware = require('flitter-auth/middleware/KeyAction')
|
||||
* KeyAction Middleware
|
||||
* -------------------------------------------------------------
|
||||
* Middleware for processing key actions.
|
||||
*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
class KeyAction extends Middleware {
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* -------------------------------------------------------------
|
||||
* Allows the request to proceed if a valid OAuth2 bearer token was
|
||||
* provided. If not, return a JSON-encoded error message.
|
||||
*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
const Middleware = require('flitter-auth/middleware/Oauth2TokenOnly')
|
||||
class Oauth2TokenOnly extends Middleware {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* -------------------------------------------------------------
|
||||
* Redirects the user to the login page if the registration page for
|
||||
* a particular auth provider is not enabled.
|
||||
*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
const Middleware = require('flitter-auth/middleware/ProviderRegistrationEnabled')
|
||||
class ProviderRegistrationEnabled extends Middleware {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
* Many auth routes specify the name of a particular auth provider to
|
||||
* use. This middleware looks up the provider by that name and injects
|
||||
* it into the request.
|
||||
*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
const Middleware = require('flitter-auth/middleware/ProviderRoute')
|
||||
class ProviderRoute extends Middleware {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
* Allows the request to proceed if there's an authenticated user
|
||||
* in the session. Otherwise, redirects the user to the login page
|
||||
* of the default provider.
|
||||
*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
const Middleware = require('flitter-auth/middleware/UserOnly')
|
||||
class UserOnly extends Middleware {
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
* This should be applied globally. Ensures basic things about the
|
||||
* request are true. For example, it provides the auth session data
|
||||
* and handles auth flow.
|
||||
*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
const Middleware = require('flitter-auth/middleware/Utility')
|
||||
class Utility extends Middleware {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
const Middleware = require('flitter-i18n/src/middleware/Localize')
|
||||
|
||||
/*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
class LocalizeMiddleware extends Middleware {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
const Middleware = require('flitter-i18n/src/middleware/Scope')
|
||||
|
||||
/*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
class ScopeMiddleware extends Middleware {
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ const { Middleware } = require('libflitter')
|
||||
*
|
||||
* The 'value' attribute is optional. If none is provided, the request
|
||||
* can proceed if the config value is truthy.
|
||||
*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
class Config extends Middleware {
|
||||
static get services() {
|
||||
|
||||
@@ -47,15 +47,25 @@ const index = {
|
||||
'controller::Home.welcome'
|
||||
],
|
||||
|
||||
// Get information about the user's team
|
||||
'/my-team': ['controller::Teams.get_my_team'],
|
||||
|
||||
// Get a list of the user's team's players
|
||||
'/my-team/players': ['controller::Teams.get_my_team_players'],
|
||||
|
||||
// Get the uesr's team's current lineup
|
||||
'/my-team/lineup': ['controller::Teams.get_my_team_current_lineup'],
|
||||
|
||||
// Get a list of players available to be drafted
|
||||
'/draft-board/available': ['controller::DraftBoard.get_available_players'],
|
||||
|
||||
// Get a list of matchup, grouped by week number
|
||||
'/matchups': ['controller::Scores.get_weekly_scores'],
|
||||
|
||||
// Get the current league standings
|
||||
'/league-standings': ['controller::Scores.get_league_standings'],
|
||||
|
||||
// Get the status of the current user's session, and game play
|
||||
'/status': ['controller::Home.get_status'],
|
||||
},
|
||||
|
||||
@@ -67,9 +77,13 @@ const index = {
|
||||
* or middleware that are applied in order.
|
||||
*/
|
||||
post: {
|
||||
// Save changes to the current user's team
|
||||
'/my-team': ['controller::Teams.save_my_team'],
|
||||
|
||||
// Save the current user's team's lineup
|
||||
'/my-team/lineup': ['controller::Teams.save_my_team_lineup'],
|
||||
|
||||
// Draft the given player to the current user's team
|
||||
'/draft-board/draft-player': ['controller::DraftBoard.draft_player_to_team'],
|
||||
},
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
* You can omit the provider name to use the default provider:
|
||||
*
|
||||
* /auth/register
|
||||
*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
const index = {
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
|
||||
/*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
module.exports = exports = {
|
||||
prefix: '/auth/action', // This is assumed by flitter-auth. Don't change it.
|
||||
middleware: [],
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
* oauth2 Routes
|
||||
* -------------------------------------------------------------
|
||||
* Routes pertaining to the flitter-auth OAuth2 server implementation.
|
||||
*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
const oauth2 = {
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* -------------------------------------------------------------
|
||||
* This is a sample routes file. Routes and their handlers should be
|
||||
* defined here, but no logic should occur.
|
||||
*
|
||||
* This file was automatically generated by the Flitter framework.
|
||||
*/
|
||||
const index = {
|
||||
|
||||
@@ -47,24 +49,7 @@ const index = {
|
||||
|
||||
// Placeholder for auth dashboard. You'd replace this with
|
||||
// your own route protected by 'middleware::auth:UserOnly'
|
||||
'/dash': [ 'controller::Home.welcome' ],
|
||||
|
||||
'/api/list-all-teams': [
|
||||
'controller::Teams.list_all_teams'
|
||||
],
|
||||
},
|
||||
|
||||
/*
|
||||
* Define POST routes.
|
||||
* These routes are registered as POST methods.
|
||||
* Handlers for these routes should be specified as
|
||||
* an array of canonical references to controller methods
|
||||
* or middleware that are applied in order.
|
||||
*/
|
||||
post: {
|
||||
'/api/create-team': [
|
||||
'controller::Teams.create_team'
|
||||
],
|
||||
'/dash': ['controller::Home.welcome'],
|
||||
},
|
||||
|
||||
// You can include other HTTP verbs here.
|
||||
|
||||
Reference in New Issue
Block a user