From 2825ad00abdf09bc1f3491f3ea9741cd82600d06 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 18 Mar 2019 15:56:56 +0000 Subject: [PATCH] New moderator data models --- Houdini/Data/Moderator.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Houdini/Data/Moderator.py diff --git a/Houdini/Data/Moderator.py b/Houdini/Data/Moderator.py new file mode 100644 index 0000000..cae997a --- /dev/null +++ b/Houdini/Data/Moderator.py @@ -0,0 +1,37 @@ +from Houdini.Data import db + + +class Ban(db.Model): + __tablename__ = 'ban' + + PenguinID = db.Column(db.ForeignKey('penguin.ID', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, + nullable=False) + Issued = db.Column(db.DateTime, primary_key=True, nullable=False, server_default=db.text("now()")) + Expires = db.Column(db.DateTime, primary_key=True, nullable=False, server_default=db.text("now()")) + ModeratorID = db.Column(db.ForeignKey('penguin.ID', ondelete='CASCADE', onupdate='CASCADE'), index=True) + Reason = db.Column(db.SmallInteger, nullable=False) + Comment = db.Column(db.Text) + + +class Warning(db.Model): + __tablename__ = 'warning' + + PenguinID = db.Column(db.ForeignKey('penguin.ID', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True, + nullable=False) + Issued = db.Column(db.DateTime, primary_key=True, nullable=False) + Expires = db.Column(db.DateTime, primary_key=True, nullable=False) + Type = db.Column(db.SmallInteger, nullable=False) + Comment = db.Column(db.Text, nullable=False) + + +class Report(db.Model): + __tablename__ = 'report' + + ID = db.Column(db.Integer, primary_key=True, server_default=db.text("nextval('\"report_ID_seq\"'::regclass)")) + PenguinID = db.Column(db.ForeignKey('penguin.ID', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) + ReporterID = db.Column(db.ForeignKey('penguin.ID', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) + ReportType = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0")) + Date = db.Column(db.DateTime, nullable=False, server_default=db.text("now()")) + ServerID = db.Column(db.Integer, nullable=False) + RoomID = db.Column(db.ForeignKey('room.ID', ondelete='CASCADE', onupdate='CASCADE'), nullable=False) +