50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
#!/usr/bin/python3
|
|
|
|
from csv import unregister_dialect
|
|
import email
|
|
from sqlite3 import Date
|
|
from ssl import _PasswordType
|
|
from xmlrpc.client import DateTime
|
|
from sqlalchemy import Column, Integer, Float, String, Text, TIMESTAMP,ForeignKey
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy import func, create_engine,join
|
|
from config import CONFIG
|
|
|
|
Base = declarative_base()
|
|
|
|
|
|
class USER(Base):
|
|
__tablename__ = 'user'
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
username = Column(String)
|
|
password = Column(String) #mogoče raje kaj drugega, neki hash passworda al neki
|
|
email = Column(String)
|
|
|
|
|
|
class Item(Base):
|
|
__tablename__ = 'item'
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
owner_id = Column(String, ForeignKey("user.id"), nullable=False)
|
|
item_location = Column(String)
|
|
item_type = Column(String)
|
|
item_size = Column(Integer)
|
|
|
|
|
|
class Interest(Base):
|
|
__tablename__ = 'interest'
|
|
pdf_id = Column(String, ForeignKey("item.id"), nullable=False)
|
|
user_id = Column(String, ForeignKey("user.id"), nullable=False)
|
|
interest_rate = Column(Float)
|
|
#ali
|
|
# date_added = Column(String)
|
|
# last_review = Column(DateTime)
|
|
# interval = Column(Integer)
|
|
# due = Column(DateTime)
|
|
|
|
|
|
|
|
engine = create_engine(CONFIG['DB_CONNECTION'])
|
|
|
|
Base.metadata.create_all(engine)
|