From 56ffeb2a0169efd51178f16b03aeeb61cfb55b44 Mon Sep 17 00:00:00 2001 From: Sorrel Bri Date: Tue, 1 Oct 2019 20:42:21 -0700 Subject: [PATCH] create basic TimeSettings model --- models/Message.py | 2 +- models/TimeSettings.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/models/Message.py b/models/Message.py index b055a17..0c50d42 100644 --- a/models/Message.py +++ b/models/Message.py @@ -13,7 +13,7 @@ class Message(db.Model): content = db.Column(db.String(200)) # foreing key - game = db.Column(db.Integer, db.ForeignKey("move.id")) + move = db.Column(db.Integer, db.ForeignKey("move.id")) def __init__(self): pass \ No newline at end of file diff --git a/models/TimeSettings.py b/models/TimeSettings.py index e69de29..1a18d04 100644 --- a/models/TimeSettings.py +++ b/models/TimeSettings.py @@ -0,0 +1,25 @@ +from ..app import db, ma +import enum + +class TimeTypes(enum.Enum): + BYOYOMI = "Counting by time period" + ABSOLUTE = "One period to use time" + HOURGLASS = "Absolute time for both players" + NONE = "Untimed" + +class TimeSettings(db.Model): + __table_args__ = {'extend_existing': True} + + id = db.Column(db.Integer, primary_key=True) + main_time = db.Column(db.Enum(Time)) + time_period = db.Column(db.Integer) # number of periods + period_length = db.Column(db.Integer) # seconds + overtime = db.Column(db.Enum()) + overtime_period = db.Column(db.Integer) # number of overtime periods + overtime_length = db.Column(db.Integer) # seconds + + # foreing key + game = db.Column(db.Integer, db.ForeignKey("game.id")) + + def __init__(self): + pass \ No newline at end of file