some fixes and refactors
This commit is contained in:
parent
ead8a566d0
commit
75cfc6c928
16 changed files with 381 additions and 425 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from contextlib import asynccontextmanager
|
||||
from datetime import datetime
|
||||
from typing import Any, Callable, Generic, TypeVar
|
||||
from typing import Callable, Generic, TypeVar
|
||||
|
||||
from fastapi import FastAPI, Depends, HTTPException, Response, status, Query
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
|
@ -8,6 +8,20 @@ from pydantic import BaseModel
|
|||
from sqlalchemy import select, func, desc
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from auth import (
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES,
|
||||
COOKIE_NAME,
|
||||
UserCreate,
|
||||
UserLogin,
|
||||
UserResponse,
|
||||
get_password_hash,
|
||||
get_user_by_email,
|
||||
authenticate_user,
|
||||
create_access_token,
|
||||
get_current_user,
|
||||
require_permission,
|
||||
build_user_response,
|
||||
)
|
||||
from database import engine, get_db, Base
|
||||
from models import Counter, User, SumRecord, CounterRecord, Permission, Role, ROLE_REGULAR
|
||||
from validation import validate_profile_fields
|
||||
|
|
@ -47,20 +61,6 @@ async def paginate_with_user_email(
|
|||
|
||||
records: list[R] = [row_mapper(record, email) for record, email in rows]
|
||||
return records, total, total_pages
|
||||
from auth import (
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES,
|
||||
COOKIE_NAME,
|
||||
UserCreate,
|
||||
UserLogin,
|
||||
UserResponse,
|
||||
get_password_hash,
|
||||
get_user_by_email,
|
||||
authenticate_user,
|
||||
create_access_token,
|
||||
get_current_user,
|
||||
require_permission,
|
||||
build_user_response,
|
||||
)
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue