Rev 21367 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
'''Created on 19-Sep-2012@author: rajveer'''from elixir.entity import Entityfrom elixir.fields import Fieldfrom elixir.options import using_options, using_table_optionsfrom sqlalchemy.types import Integer, DateTimefrom elixir.relationships import ManyToOnefrom shop2020.utils.Utils import to_py_date, to_java_datefrom shop2020.thriftpy.model.v1.order.ttypes import UserWalletHistory as tUserWalletHistoryclass UserWalletHistory(Entity):'''classdocs'''id = Field(Integer, primary_key=True, autoincrement=True)amount = Field(Integer)wallet = ManyToOne("UserWallet")orderId = Field(Integer)timestamp = Field(DateTime)using_options(shortnames=True)using_table_options(mysql_engine="InnoDB")def __init__(self):'''Constructor'''def to_thrift_object(self, ):'''Copies attributes to thrift object'''thriftObject = tUserWalletHistory()thriftObject.id = self.idthriftObject.amount = self.amountthriftObject.orderId = self.orderIdthriftObject.walletId = self.wallet.idthriftObject.timestamp = to_java_date(self.timestamp)return thriftObjectdef from_thrift_object(self, thriftUserWalletHistory):self.id = thriftUserWalletHistory.idself.amount = thriftUserWalletHistory.amountself.orderId = thriftUserWalletHistory.orderIdself.wallet.id = thriftUserWalletHistory.walletIdself.timestamp = to_py_date(thriftUserWalletHistory.timestamp)def is_valid(self):return True