#5 Started wiring up endpoints do display user stats
This commit is contained in:
@ -5,11 +5,13 @@ from flask import redirect, Blueprint, session
|
||||
|
||||
from . import user
|
||||
from . import product
|
||||
from . import stats
|
||||
|
||||
blueprint = Blueprint('main', __name__)
|
||||
|
||||
blueprint.register_blueprint(user.blueprint)
|
||||
blueprint.register_blueprint(product.blueprint)
|
||||
blueprint.register_blueprint(stats.blueprint)
|
||||
|
||||
|
||||
# CONTEXTS #
|
||||
|
33
controllers/web/stats.py
Normal file
33
controllers/web/stats.py
Normal file
@ -0,0 +1,33 @@
|
||||
""" The user controller to manage all of the stats related endpoints
|
||||
in the web app
|
||||
"""
|
||||
import json
|
||||
from flask import Blueprint
|
||||
|
||||
from flask import render_template, redirect, request, session, flash
|
||||
from controllers.database.stats import StatsController
|
||||
from models.stats import Stats
|
||||
from models.users.user import User
|
||||
|
||||
# Blueprint to append user endpoints to
|
||||
blueprint = Blueprint("stats", __name__, url_prefix='/stats')
|
||||
|
||||
|
||||
@blueprint.route('/')
|
||||
def stats_index():
|
||||
db = StatsController()
|
||||
data = db.read()
|
||||
return ""
|
||||
|
||||
|
||||
@blueprint.route('/product/<int:id>')
|
||||
def view_product_stats(id: int):
|
||||
db = StatsController()
|
||||
data = db.read_product(id)
|
||||
return ""
|
||||
|
||||
@blueprint.route('/user/<int:id>')
|
||||
def view_user_stats(id: int):
|
||||
db = StatsController()
|
||||
data = db.read_user(id)
|
||||
return ""
|
Reference in New Issue
Block a user