|
|
|
from peewee import *
|
|
|
|
from datetime import datetime
|
|
|
|
from suchwow import config
|
|
|
|
|
|
|
|
|
|
|
|
db = SqliteDatabase(f"{config.DATA_FOLDER}/db/sqlite.db")
|
|
|
|
|
|
|
|
class Post(Model):
|
|
|
|
id = AutoField()
|
|
|
|
title = CharField()
|
|
|
|
text = CharField()
|
|
|
|
# submitter = ForeignKeyField(Profile, field=Profile.username)
|
|
|
|
submitter = CharField()
|
|
|
|
image_name = CharField()
|
|
|
|
readonly = BooleanField(default=False)
|
|
|
|
hidden = BooleanField(default=False)
|
|
|
|
account_index = IntegerField()
|
|
|
|
address_index = IntegerField()
|
|
|
|
timestamp = DateTimeField(default=datetime.now)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
database = db
|
|
|
|
|
|
|
|
class Profile(Model):
|
|
|
|
id = AutoField()
|
|
|
|
username = CharField()
|
|
|
|
address = CharField()
|
|
|
|
notifications = IntegerField(default=0)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
database = db
|
|
|
|
|
|
|
|
class Comment(Model):
|
|
|
|
id = AutoField()
|
|
|
|
comment = TextField()
|
|
|
|
commenter = ForeignKeyField(Profile)
|
|
|
|
post = ForeignKeyField(Post)
|
|
|
|
timestamp = DateTimeField(default=datetime.now)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
database = db
|
|
|
|
|
|
|
|
class Notification(Model):
|
|
|
|
type = CharField()
|
|
|
|
message = TextField()
|
|
|
|
username = ForeignKeyField(Profile)
|
|
|
|
timestamp = DateTimeField(default=datetime.now)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
database = db
|