-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmodels.py
27 lines (21 loc) · 797 Bytes
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import datetime
import jwt
from sqlalchemy import Column, String, Integer, DateTime
from sqlalchemy_utils import UUIDType
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.hybrid import hybrid_property
Base = declarative_base()
class ToDoEntry(Base):
__tablename__ = "ToDos"
id = Column("id", Integer, primary_key=True, autoincrement=True)
__user_id = Column("user_id", UUIDType(binary=False), nullable=False)
title = Column(String(200), nullable=False)
text = Column(String(2000), nullable=False)
created_at = Column(DateTime, nullable=False, default=datetime.datetime.utcnow)
updated_at = Column(DateTime)
@hybrid_property
def user_id(self):
return self.__user_id
@user_id.setter
def user_id(self, user_id):
self.__user_id = user_id