routing and model __init__ updates

This commit is contained in:
Gardient
2021-09-22 19:25:51 +03:00
parent 98a8747821
commit ef431c28ca
5 changed files with 36 additions and 21 deletions

View File

@@ -1,11 +1,14 @@
from api.database import (Model, SurrogatePK, db,
Column, reference_col, relationship)
Column)
class TargetExchange(SurrogatePK, Model):
__tablename__ = "target-exchange"
name = Column(db.String(255), unique=True, nullable=False)
def __init__(self, **kwargs):
super(TargetExchange, self).__init__(**kwargs)
@staticmethod
def ensure_created(name):
if TargetExchange.query.filter_by(name=name).first() is None: