2020-07-15 08:18:13 +00:00
|
|
|
from peewee import *
|
|
|
|
from datetime import datetime
|
2020-08-10 05:47:53 +00:00
|
|
|
from suchwow import config
|
2020-07-15 08:18:13 +00:00
|
|
|
|
|
|
|
|
2020-08-10 06:59:45 +00:00
|
|
|
db = SqliteDatabase(f"{config.DATA_FOLDER}/db/sqlite.db")
|
2020-07-15 08:18:13 +00:00
|
|
|
|
2020-07-28 20:31:07 +00:00
|
|
|
class Post(Model):
|
2020-07-15 08:18:13 +00:00
|
|
|
id = AutoField()
|
|
|
|
title = CharField()
|
2020-08-08 06:12:33 +00:00
|
|
|
text = CharField()
|
2020-07-15 08:18:13 +00:00
|
|
|
submitter = CharField()
|
|
|
|
image_name = CharField()
|
2020-07-28 20:31:07 +00:00
|
|
|
readonly = BooleanField(default=False)
|
|
|
|
hidden = BooleanField(default=False)
|
|
|
|
account_index = IntegerField()
|
|
|
|
address_index = IntegerField()
|
|
|
|
timestamp = DateTimeField(default=datetime.now)
|
2020-10-15 06:51:53 +00:00
|
|
|
reddit_url = CharField(null=True)
|
2020-10-18 04:39:19 +00:00
|
|
|
to_reddit = BooleanField(default=False)
|
2020-07-28 20:31:07 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
database = db
|
|
|
|
|
|
|
|
class Profile(Model):
|
|
|
|
id = AutoField()
|
|
|
|
username = CharField()
|
|
|
|
address = CharField()
|
2020-08-10 06:59:45 +00:00
|
|
|
notifications = IntegerField(default=0)
|
2020-07-28 20:31:07 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
database = db
|
|
|
|
|
|
|
|
class Comment(Model):
|
|
|
|
id = AutoField()
|
|
|
|
comment = TextField()
|
2020-08-10 06:59:45 +00:00
|
|
|
commenter = ForeignKeyField(Profile)
|
|
|
|
post = ForeignKeyField(Post)
|
2020-07-28 20:31:07 +00:00
|
|
|
timestamp = DateTimeField(default=datetime.now)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
database = db
|
|
|
|
|
|
|
|
class Notification(Model):
|
|
|
|
type = CharField()
|
|
|
|
message = TextField()
|
2020-08-10 06:59:45 +00:00
|
|
|
username = ForeignKeyField(Profile)
|
2020-07-15 08:18:13 +00:00
|
|
|
timestamp = DateTimeField(default=datetime.now)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
database = db
|