crappy
This commit is contained in:
@@ -0,0 +1 @@
|
||||
from .models.basic import *
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Depends
|
||||
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
|
||||
from sqlalchemy.orm import sessionmaker, declarative_base
|
||||
|
||||
@@ -16,3 +19,6 @@ BaseModel = declarative_base()
|
||||
async def get_session() -> AsyncSession:
|
||||
async with session_maker() as session:
|
||||
yield session
|
||||
|
||||
|
||||
DatabaseDependency = Annotated[AsyncSession, Depends(get_session)]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from sqlalchemy import Column, Integer, String
|
||||
from sqlalchemy import Column, Integer, String, BigInteger, Boolean
|
||||
|
||||
from ..base import BaseModel
|
||||
|
||||
@@ -6,5 +6,7 @@ from ..base import BaseModel
|
||||
class User(BaseModel):
|
||||
__tablename__ = 'users'
|
||||
id = Column(Integer, autoincrement=True, primary_key=True, index=True)
|
||||
login = Column(String, unique=True)
|
||||
password = Column(String, unique=True)
|
||||
telegram_id = Column(BigInteger, nullable=False, index=True)
|
||||
phone_number = Column(String)
|
||||
|
||||
is_admin = Column(Boolean, nullable=False, default=False)
|
||||
|
||||
Reference in New Issue
Block a user