Files
ShooterHub/blueprints/dashboard.py

21 lines
572 B
Python
Raw Normal View History

from flask import Blueprint, render_template
from flask_login import current_user, login_required
from sqlalchemy import select
from extensions import db
from models import Analysis
dashboard_bp = Blueprint("dashboard", __name__, url_prefix="/dashboard")
@dashboard_bp.route("/")
@login_required
def index():
analyses = db.session.scalars(
select(Analysis)
.where(Analysis.user_id == current_user.id)
.order_by(Analysis.created_at.desc())
.limit(50)
).all()
return render_template("dashboard/index.html", analyses=analyses)