class User(db.Model): __tablename__ = "user" id = db.Column(db.Integer, db.Sequence("seq_user_id"), primary_key=True) name = db.Column(db.String(32)) login = db.Column(db.String(32), unique=True) password = db.Column(db.String(32)) token = db.Column(db.String(100)) expiration = db.Column(db.DateTime)
class Purchaser(db.Model): __tablename__ = "purchaser" id = db.Column(db.Integer, default=db.Sequence('trigger_id_seq'), primary_key=True) name = db.Column(db.String(255)) created_timestamp = db.Column(db.DateTime, default=datetime.now, onupdate=datetime.now)
class Transaction(db.Model): __tablename = "transaction" transaction_id = db.Column(db.Integer, default=db.Sequence('trigger_id_seq'), primary_key=True) purchaser_id = db.Column(db.Integer, db.ForeignKey("purchaser.id")) product_id = db.Column(db.Integer, db.ForeignKey("products.id")) created_timestamp = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
class CDR(db.Model): """ Call Detail Records holds information about finished calls """ __tablename__ = 'cdr' id_ = db.Column(db.Integer, db.Sequence('cdr_id_seq'), primary_key=True) answer = db.Column(db.DateTime) billsec = db.Column(db.Integer) from_user_id = db.Column(db.Integer, db.ForeignKey('users.id_')) from_user = db.relationship('User', backref='originated_calls', foreign_keys=from_user_id) to_user_id = db.Column(db.Integer, db.ForeignKey('users.id_')) to_user = db.relationship('User', backref='received_calls', foreign_keys=to_user_id) def __repr__(self): return '<from=%s date=%s duration=%s>' % (self.from_user, self.answer, self.billsec)
class admins(db.Model): __tablename__ = 'admins' id = db.Column('id', db.Unicode, db.Sequence('alumni_id_seq'), primary_key=True) username = db.Column('username', db.Unicode) group_password = db.Column('group_password', db.Unicode) def __init__(self, username): self.username = username def is_authenticated(self): return self.authenticated def is_active(self): return self.confirm_email def is_anonymous(self): return False def get_id(self): return self.username
class Auditory(db.Model): __tablename__ = "auditory" id = db.Column(db.Integer, db.Sequence("seq_aud_id"), primary_key=True) name = db.Column(db.String(32), unique=True)
class Teacher(db.Model): __tablename__ = "teacher" id = db.Column(db.Integer, db.Sequence("seq_tech_id"), primary_key=True) name = db.Column(db.String(32), unique=True)
class Faculty(db.Model): __tablename__ = "faculty" id = db.Column(db.Integer, db.Sequence("seq_fac_id"), primary_key=True) name = db.Column(db.String(32), unique=True)