Subversion Repositories SmartDukaan

Rev

Rev 20927 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6031 rajveer 1
'''
2
Created on 19-Sep-2012
3
 
4
@author: mandeep
5
'''
6
from elixir.entity import Entity
7
from elixir.fields import Field
8
from elixir.options import using_options, using_table_options
9
from elixir.relationships import OneToMany
10
from sqlalchemy.types import Integer
11
from shop2020.thriftpy.model.v1.order.ttypes import UserWallet as tUserWallet
12
 
13
class UserWallet(Entity):
14
    '''
15
    classdocs
16
    '''
17
    id = Field(Integer, primary_key=True, autoincrement=True)
18
    userId = Field(Integer)
19
    amount = Field(Integer)
20
    userWalletHistory = OneToMany("UserWalletHistory")
21
    using_options(shortnames=True)
22
    using_table_options(mysql_engine="InnoDB")
23
 
24
    def __init__(self):
25
        '''
26
        Constructor
27
        '''
28
 
29
    def to_thrift_object(self, ):
30
        '''
31
        Copies attributes to thrift object
32
        '''
33
        thriftObject = tUserWallet()
34
        thriftObject.id = self.id
35
        thriftObject.userId = self.userId
36
        thriftObject.amount = self.amount
37
        return thriftObject
38
 
39
    def from_thrift_object(self, thriftUserWallet):
40
        self.id = thriftUserWallet.id
41
        self.userId = thriftUserWallet.userId
42
        self.amount = thriftUserWallet.amount
43
 
44
    def is_valid(self):
45
        return True