flaschengeist/geruecht/model/creditList.py

60 lines
2.3 KiB
Python

from geruecht import db
from datetime import datetime
class CreditList(db.Model):
""" DataBase Object Credit List:
Attributes:
id: id in Database. Is the Primary Key
<month>_guthaben: Credit of the Month.
<month>_schulden: Debt of the Month.
last_schulden: Debt or Credit of last Year.
year: Year of all Credits and Debts.
TODO: link to user???
"""
id = db.Column(db.Integer, primary_key=True)
jan_guthaben = db.Column(db.Integer, nullable=False, default=0)
jan_schulden = db.Column(db.Integer, nullable=False, default=0)
feb_guthaben = db.Column(db.Integer, nullable=False, default=0)
feb_schulden = db.Column(db.Integer, nullable=False, default=0)
maer_guthaben = db.Column(db.Integer, nullable=False, default=0)
maer_schulden = db.Column(db.Integer, nullable=False, default=0)
apr_guthaben = db.Column(db.Integer, nullable=False, default=0)
apr_schulden = db.Column(db.Integer, nullable=False, default=0)
mai_guthaben = db.Column(db.Integer, nullable=False, default=0)
mai_schulden = db.Column(db.Integer, nullable=False, default=0)
jun_guthaben = db.Column(db.Integer, nullable=False, default=0)
jun_schulden = db.Column(db.Integer, nullable=False, default=0)
jul_guthaben = db.Column(db.Integer, nullable=False, default=0)
jul_schulden = db.Column(db.Integer, nullable=False, default=0)
aug_guthaben = db.Column(db.Integer, nullable=False, default=0)
aug_schulden = db.Column(db.Integer, nullable=False, default=0)
sep_guthaben = db.Column(db.Integer, nullable=False, default=0)
sep_schulden = db.Column(db.Integer, nullable=False, default=0)
okt_guthaben = db.Column(db.Integer, nullable=False, default=0)
okt_schulden = db.Column(db.Integer, nullable=False, default=0)
nov_guthaben = db.Column(db.Integer, nullable=False, default=0)
nov_schulden = db.Column(db.Integer, nullable=False, default=0)
dez_guthaben = db.Column(db.Integer, nullable=False, default=0)
dez_schulden = db.Column(db.Integer, nullable=False, default=0)
last_schulden = db.Column(db.Integer, nullable=False, default=0)
year = db.Column(db.Integer, nullable=False, default=datetime.now().year)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)