36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
|
from fastapi import FastAPI, APIRouter, Depends, Request, HTTPException, Form
|
||
|
from fastapi.templating import Jinja2Templates
|
||
|
from fastapi.responses import RedirectResponse, HTMLResponse
|
||
|
from fastapi.responses import JSONResponse
|
||
|
import jwt
|
||
|
|
||
|
from sqlalchemy.future import select
|
||
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||
|
|
||
|
|
||
|
from routers.auth import get_current_user
|
||
|
from model.database import get_async_session, Job
|
||
|
|
||
|
router = APIRouter()
|
||
|
templates = Jinja2Templates(directory="templates")
|
||
|
|
||
|
@router.get("/product")
|
||
|
async def product(request: Request,
|
||
|
username: str = Depends(get_current_user),
|
||
|
session: AsyncSession = Depends(get_async_session)):
|
||
|
size = "Work"
|
||
|
username = username
|
||
|
|
||
|
query = select(Job)
|
||
|
result = await session.execute(query)
|
||
|
jobs = result.scalars().all()
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
return templates.TemplateResponse("product.html", {"request": request, "size": size,
|
||
|
"jobs": jobs, "role": username["role"],
|
||
|
"username": username['username'],
|
||
|
"current_path": request.url.path })#
|