aboutsummaryrefslogtreecommitdiff
path: root/models.py
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2024-11-06 01:08:04 -0600
committerParker <contact@pkrm.dev>2024-11-06 01:08:04 -0600
commit4c1dd74db3f9ac37134db13c8e5a499a9f37594a (patch)
tree5f9b72c25b66586e22d18ec5fd55e262e6eb3e2c /models.py
parenteadc9289338e8537c1ee70274007eea2dc395bde (diff)
Lots more functionality - working towards UI
Diffstat (limited to 'models.py')
-rw-r--r--models.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/models.py b/models.py
index 6061661..27f1436 100644
--- a/models.py
+++ b/models.py
@@ -6,6 +6,7 @@ from sqlalchemy import (
Text,
DateTime,
)
+import datetime
from database import Base
@@ -23,7 +24,10 @@ class Link(Base):
link = Column(String, primary_key=True)
owner = Column(Integer, ForeignKey("users.id"), nullable=False)
redirect_link = Column(String, nullable=False)
- expire_date = Column(DateTime, nullable=False)
+ expire_date = Column(
+ DateTime,
+ default=datetime.datetime.utcnow() + datetime.timedelta(days=30),
+ )
class Log(Base):
@@ -31,7 +35,7 @@ class Log(Base):
id = Column(Integer, primary_key=True)
owner = Column(Integer, ForeignKey("users.id"), nullable=False)
link = Column(String, ForeignKey("links.link"), nullable=False)
- timestamp = Column(DateTime, nullable=False)
+ timestamp = Column(DateTime, default=datetime.datetime.utcnow())
ip = Column(String, nullable=False)
location = Column(String, nullable=False)
browser = Column(String, nullable=False)