1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-12-17 23:24:20 +00:00
royalnet/royalpack/tables/treasure.py

24 lines
522 B
Python
Raw Normal View History

2020-05-21 13:16:03 +00:00
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declared_attr
class Treasure:
__tablename__ = "treasures"
@declared_attr
def code(self):
return Column(String, primary_key=True)
@declared_attr
def redeemed_by_id(self):
return Column(Integer, ForeignKey("users.uid"))
@declared_attr
def redeemed_by(self):
return relationship("User")
@declared_attr
def value(self):
return Column(Integer, nullable=False)