2017-03-04 19:29:44 +00:00
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
|
|
|
|
db = SQLAlchemy()
|
|
|
|
|
|
|
|
class MatrixUser(db.Model):
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
matrix_id = db.Column(db.Text, unique=True)
|
|
|
|
room_id = db.Column(db.Text)
|
|
|
|
pnut_id = db.Column(db.Text, unique=True)
|
|
|
|
pnut_token = db.Column(db.Text)
|
|
|
|
|
|
|
|
def __init__(self, matrix_id, room_id, pnut_id, pnut_token):
|
|
|
|
self.matrix_id = matrix_id
|
|
|
|
self.room_id = room_id
|
|
|
|
self.pnut_id = pnut_id
|
|
|
|
self.pnut_token = pnut_token
|
|
|
|
|
|
|
|
def __repr__(self):
|
2017-03-04 20:54:43 +00:00
|
|
|
return '<MatrixUser %r>' % self.matrix_id
|
|
|
|
|
|
|
|
class MatrixRoom(db.Model):
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
room_id = db.Column(db.Text, unique=True)
|
|
|
|
pnut_chan = db.Column(db.Text)
|
|
|
|
pnut_since = db.Column(db.Text)
|
|
|
|
pnut_write = db.Column(db.Boolean, default=True)
|
|
|
|
|
|
|
|
def __init__(self, room_id, pnut_chan, pnut_write=True):
|
|
|
|
self.room_id = room_id
|
|
|
|
self.pnut_chan = pnut_chan
|
|
|
|
self.pnut_write = pnut_write
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return '<MatrixRoom %r>' % self.room_id
|