23 lines
866 B
Python
23 lines
866 B
Python
from fastapi import HTTPException
|
||
from sqlalchemy import Column, Integer, String, Float, Boolean, ForeignKey
|
||
from sqlalchemy.dialects.postgresql import ARRAY
|
||
from sqlalchemy.orm import Session, relationship
|
||
from ..config import Base
|
||
|
||
|
||
|
||
'''
|
||
##### veri tabanı modelleri #####
|
||
class Collections(Base):
|
||
__tablename__ = "collections_table"
|
||
|
||
collection_id = Column(Integer, index=True, primary_key=True , autoincrement=True)
|
||
user_id = Column(Integer, ForeignKey('users_table.user_id'), nullable=False)
|
||
visibility = Column(Boolean, default=True)
|
||
colllection_name = Column(String, default="No name")
|
||
collection_description = Column(String, default="No description")
|
||
|
||
# ilişkiler
|
||
user = relationship("DBUser", back_populates="user_collections")
|
||
items = relationship("Items", back_populates="collection", cascade="all, delete-orphan")
|
||
''' |