forked from rDrama/rDrama
sneed
parent
c3e99fb6a7
commit
af5f2ea9d5
|
@ -3,16 +3,18 @@
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
#from .mix_ins import *
|
#from .mix_ins import *
|
||||||
from drama.__main__ import Base
|
from drama.__main__ import Base, app
|
||||||
|
|
||||||
AWARDS = {
|
AWARDS = {
|
||||||
"ban": {
|
"ban": {
|
||||||
|
"kind": "ban",
|
||||||
"title": "1-Day Ban",
|
"title": "1-Day Ban",
|
||||||
"description": "Ban the author for a day.",
|
"description": "Ban the author for a day.",
|
||||||
"icon": "fas fa-gavel",
|
"icon": "fas fa-gavel",
|
||||||
"color": "text-danger"
|
"color": "text-danger"
|
||||||
},
|
},
|
||||||
"shit": {
|
"shit": {
|
||||||
|
"kind": "shit",
|
||||||
"title": "Literal Shitpost",
|
"title": "Literal Shitpost",
|
||||||
"description": "Let OP know how much their post sucks ass.",
|
"description": "Let OP know how much their post sucks ass.",
|
||||||
"icon": "fas fa-poop",
|
"icon": "fas fa-poop",
|
||||||
|
@ -28,8 +30,8 @@ class AwardRelationship(Base):
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
|
|
||||||
user_id = Column(Integer, ForeignKey("users.id"))
|
user_id = Column(Integer, ForeignKey("users.id"))
|
||||||
submission_id = Column(Integer, ForeignKey("submissions.id"))
|
submission_id = Column(Integer, ForeignKey("submissions.id"), default=None)
|
||||||
comment_id = Column(Integer, ForeignKey("comments.id"))
|
comment_id = Column(Integer, ForeignKey("comments.id"), default=None)
|
||||||
kind = Column(String(20))
|
kind = Column(String(20))
|
||||||
|
|
||||||
user = relationship("User", primaryjoin="AwardRelationship.user_id==User.id", lazy="joined")
|
user = relationship("User", primaryjoin="AwardRelationship.user_id==User.id", lazy="joined")
|
||||||
|
@ -44,6 +46,18 @@ class AwardRelationship(Base):
|
||||||
lazy="joined"
|
lazy="joined"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def given(self):
|
||||||
|
return bool(self.submission_id) or bool(self.comment_id)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self):
|
def type(self):
|
||||||
return AWARDS[self.kind]
|
return AWARDS[self.kind]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def title(self):
|
||||||
|
return self.type['title']
|
||||||
|
|
||||||
|
@property
|
||||||
|
def class_list(self):
|
||||||
|
return self.type['icon']+' '+self.type['color']
|
||||||
|
|
Loading…
Reference in New Issue