customizing repo from template
parent
ba660d7239
commit
600c3429c2
@ -1,38 +0,0 @@
|
||||
from datetime import datetime
|
||||
from uuid import uuid4
|
||||
|
||||
from sqlalchemy.sql import func
|
||||
|
||||
from myapp.factory import db
|
||||
from myapp import config
|
||||
|
||||
|
||||
def rand_id():
|
||||
return uuid4().hex
|
||||
|
||||
class MyThing(db.Model):
|
||||
__tablename__ = 'swaps'
|
||||
|
||||
# Meta
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
# id = db.Column(db.String(80), primary_key=True, default=rand_id) # hex based id
|
||||
date = db.Column(db.DateTime, server_default=func.now())
|
||||
my_bool = db.Column(db.Boolean)
|
||||
my_int = db.Column(db.Integer)
|
||||
my_str = db.Column(db.String(150))
|
||||
completed = db.Column(db.Boolean, default=False)
|
||||
completed_date = db.Column(db.DateTime, nullable=True)
|
||||
|
||||
def __repr__(self):
|
||||
return self.id
|
||||
|
||||
def hours_elapsed(self):
|
||||
now = datetime.utcnow()
|
||||
if since_completed:
|
||||
if self.completed_date:
|
||||
diff = now - self.completed_date
|
||||
else:
|
||||
return 0
|
||||
else:
|
||||
diff = now - self.date
|
||||
return diff.total_seconds() / 60 / 60
|
@ -0,0 +1,31 @@
|
||||
from datetime import datetime
|
||||
from uuid import uuid4
|
||||
|
||||
from sqlalchemy.sql import func
|
||||
|
||||
from xmrbackers.factory import db
|
||||
from xmrbackers import config
|
||||
|
||||
|
||||
def rand_id():
|
||||
return uuid4().hex
|
||||
|
||||
class Creator(db.Model):
|
||||
__tablename__ = 'creators'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
# id = db.Column(db.String(80), primary_key=True, default=rand_id) # hex based id
|
||||
register_date = db.Column(db.DateTime, server_default=func.now())
|
||||
last_login_date = db.Column(db.DateTime, nullable=True)
|
||||
wallet_address = db.Column(db.String(150))
|
||||
password = db.Column(db.String(150))
|
||||
email = db.Column(db.String(150))
|
||||
handle = db.Column(db.String(150))
|
||||
|
||||
def __repr__(self):
|
||||
return self.id
|
||||
|
||||
class Backer(db.Model):
|
||||
__tablename__ = 'backers'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Loading…
Reference in New Issue