class UserSetting(db.Entity): id = PrimaryKey(int) username = Optional(str) distance = Required(int, default=3000) created_at = Required(datetime, default=datetime.utcnow) updated_at = Required(datetime, default=datetime.utcnow) points_count = Required(int, default=0)
class DatabaseOrganization(database.Entity): # type: ignore """Organization ORM model""" id = PrimaryKey(UUID, default=uuid4) name = Required(str) users = Set("DatabaseUser") date_created = Required(datetime, default=datetime.utcnow) modified_at = Optional(datetime)
class IruPerson(db.Entity): id = PrimaryKey(int, auto=True) name = Required(str) age = Optional(int) gender = Optional(int) school = Optional(str) enrolling_date = Optional(str) schooling_length = Optional(int) face_encodings = Required(Json)
class DatabaseUser(database.Entity): # type: ignore """User ORM model""" id = PrimaryKey(UUID, default=uuid4) organization = Required("DatabaseOrganization") username = Required(str) password = Required(str) date_created = Required(datetime, default=datetime.utcnow) modified_at = Optional(datetime)
class Host(db.Entity): ip = Required(str, unique=True) created_at = Required(datetime, default=datetime.utcnow()) updated_at = Required(datetime, default=datetime.utcnow()) ports = Set('Port') comment = Optional(str) paths = Set('URLPath') def before_update(self): self.updated_at = datetime.utcnow()
class Port(db.Entity): num = Required(int) created_at = Required(datetime, default=datetime.utcnow()) updated_at = Required(datetime, default=datetime.utcnow()) host = Required(Host) tags = Optional(str) banner = Optional(str) comment = Optional(str) data = Optional(Json) paths = Set('URLPath')
class RutrackerForumPo(db.Entity): _table_ = "rutracker_forum_info" id = PrimaryKey(int, auto=True) forumId=Required(int, unique=True) name=Required(str, max_len=512) parentId=Required(int, default=0) parentForumId=Required(int) parentUrl=Optional(str, max_len=1024) url=Required(str, max_len=1024) totalPage=Required(int, default=0) extra=Required(str, default="{}", max_len=4096) createTime=Required(datetime, default=datetime.today) lastModifiedTime=Required(datetime, default=datetime.today) lastOperator=Required(str, default="system")
class User(db.Entity, UserMixin): login = Required(str, unique=True) password = Required(str) first_name = Required(str) last_name = Optional(str) created_at = Required(datetime, default=datetime.utcnow) last_login = Optional(datetime, default=datetime.utcnow) friends = Set('User', reverse='friends') sent = Set('Message', reverse='src') rcvd = Set('Message', reverse='dst') def check_password(self, password): return self.password == password def __str__(self): return ('%s %s' % (self.first_name, self.last_name)).rstrip()
class Meal(db.Entity): id = PrimaryKey(int, auto=True) buy_date = Required(date) expiration_date = Required(date) freezing_date = Required(date) description = Required(str) units = Required(int) weight = Required(float) unity = Required('Unity') category = Required('Category') subcategory = Optional('SubCategory') drawer = Optional(int) user = Required('User')
class RutrackerDownloadInfoPo(db.Entity): _table_ = "rutracker_album_download_info" id = PrimaryKey(int, auto=True) name= Required(str, max_len=512) url=Required(str) topicId=Required(int) status=Required(int, default=DownloadStatus.NOT) extra=Required(str, default="{}", max_len=4096) createTime=Required(datetime, default=datetime.today) lastModifiedTime=Required(datetime, default=datetime.today) lastOperator=Required(str, default="system")
class ArtistMemberRelation(db.Entity): _table_ = "artist_relation" id = PrimaryKey(int, auto=True) artistId = Required(int) bandName = Required(str) bandId = Required(int) type = Required(str, default=ArtistBandRelationType.ACTIVE) work = Optional(str) extra = Required(str, default="{}", max_len=4096) createTime = Required(datetime, default=datetime.today) lastModifiedTime = Required(datetime, default=datetime.today) lastOperator = Required(str, default="system")
class AlbumDownloadInfo(db.Entity): """ Artist table """ _table_ = "album_download_info" id = PrimaryKey(int, auto=True) albumId = Required(int) name = Required(str, max_len=512) src = Required(int) srcAlbumId = Optional(str) srcAlbumUrl = Optional(str) status = Required(int, default=DownloadStatus.NOT) extra = Required(str, default="{}", max_len=4096) createTime = Required(datetime, default=datetime.today) lastModifiedTime = Required(datetime, default=datetime.today) lastOperator = Required(str, default="system")
class Album(db.Entity): _table_ = "album" id = PrimaryKey(int, auto=True) image = Optional(str) artistId = Optional(int, default=0) name = Required(str) type = Required(int, default=AlbumType.Unsorted) releaseDate = Required(int, default=1900) label = Optional(str, default="") format = Optional(str, default="CD") duration = Optional(str) extra = Required(str, default="{}", max_len=4096) createTime = Required(datetime, default=datetime.today) lastModifiedTime = Required(datetime, default=datetime.today) lastOperator = Required(str, default="system")
class Music(db.Entity): _table_ = "music" id = PrimaryKey(int, auto=True) position = Required(int, auto=0) name = Required(str) artistId = Optional(int, default=0) otherArtistIds = Optional(str) duration = Optional(str) lyrics = Optional(str) extra = Required(str, default="{}", max_len=4096) createTime = Required(datetime, default=datetime.today) lastModifiedTime = Required(datetime, default=datetime.today) lastOperator = Required(str, default="system")
class Mobile(db.Entity): uuid = PrimaryKey(uuid.UUID, default=uuid.uuid4) imei = Required(str) os_version = Required(str) device_version = Required(str) device_token = Required(str) public_key = Required(str) private_key = Required(str) ip = Required(str) def output(self): return { "uuid": self.uuid, "imei": self.imei, "os_version": self.os_version, "device_version": self.device_version, "device_token": self.device_token, "public_key": self.public_key, "private_key": self.private_key, "ip": self.ip }
class RutrackerForumItemPo(db.Entity): _table_ = "rutracker_forum_item_info" id = PrimaryKey(int, auto=True) topicId=Required(str) topicUrl=Required(str, max_len=1024) forumId=Required(int, default=0) rutrackerForumId=Required(int) topicIcon=Optional(str, max_len=1024) newstLink=Optional(str, max_len=1024) approvedLabel=Optional(str, max_len=128) torTopicTitle=Required(str, max_len=2048) topicAuthor=Required(str, max_len=128) seeders=Optional(int, default=0) leechers=Optional(int, default=0) magnet=Optional(str, max_len=2048, default="") torrentUrl=Optional(str, max_len=1024, default="") fileSize=Optional(str, max_len=32) nReplies=Optional(int, default=0) nDownloads=Optional(int, default=0) lastPostTime=Optional(str) lastPostUser=Optional(str) lastPostUrl=Optional(str)
class Car(db.Entity): make = Required(str) model = Required(str) owner = Required(Person)
class URLPath(db.Entity): host = Required(Host) port = Required(Port) path = Required(str) cred = Optional(Cred)
class Cred(db.Entity): user = Required(str) password = Optional(str) paths = Set('URLPath')
class Artist(db.Entity): """ Artist table """ _table_ = "artist" id = PrimaryKey(int, auto=True) name = Required(str, max_len=512) country = Optional(str) location = Optional(str) image = Optional(str) age = Required(int, default=defaultAge) gender = Required(int, default=GenderEnum.MALE) isBand = Required(int, default=BandEnum.UNKOWN) status = Required(int, default=StatusEnum.ACTIVE) genre = Optional(str) lyricalThemes = Optional(str) currentLabel = Required(str, default="UNKOWN") FormedIn = Required(int, default=0) yearsActive = Optional(str) extra = Required(str, default="{}", max_len=4096) createTime = Required(datetime, default=datetime.today) lastModifiedTime = Required(datetime, default=datetime.today) lastOperator = Required(str, default="system") orm.composite_key(name, country)
class SubCategory(db.Entity): id = PrimaryKey(int, auto=True) description = Required(str, unique=True) category = Required('Category') meals = Set(Meal)
class HumidityMeasure(db.Entity): timestamp = Required(datetime) value = Required(int)
class Event(db.Entity): timestamp = Required(datetime) kind = Required(str)
class Quote(database.Entity): _table_ = "quotes" id = PrimaryKey(int, auto=True) text = Required(str) author = Required(str)
class User(db.Entity, UserMixin): id = PrimaryKey(int, auto=True) name = Required(str, unique=True) password = Required(str) meals = Set(Meal)
class CustomCommandModel(database.Entity): _table_ = "custom_commands" command = PrimaryKey(str) emit = Required(str) counter = Optional(int)
class Person(db.Entity): name = Required(str) age = Required(int) cars = Set('Car')
class User(db.Entity): name = Required(str) password = Required(str)
class TestTable(db.Entity): _table_ = "test" id = PrimaryKey(int, auto=True) name = Required(str)
class Category(db.Entity): id = PrimaryKey(int, auto=True) description = Required(str, unique=True) subcategories = Set(SubCategory) meals = Set(Meal)