mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-30 15:04:18 +00:00
23 lines
522 B
Python
23 lines
522 B
Python
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)
|