Subversion Repositories SmartDukaan

Rev

Rev 2823 | Blame | Compare with Previous | Last modification | View Log | RSS feed

'''
Created on 05-Jul-2011

@author: ashish
'''

from elixir.entity import Entity
from elixir.fields import Field
from sqlalchemy.types import String, Integer, DateTime
from elixir.options import using_options, using_table_options

from shop2020.thriftpy.utils.ttypes import DashboardUser as TDashboardUser

class DashboardUser(Entity):
    username = Field(String(30), primary_key=True)
    password =  Field(String(30))
    warehouseId = Field(Integer)
    addedOn = Field(DateTime)
    loggedOn = Field(DateTime)
    status = Field(Integer)
    otherInfo = Field(String(200))
    role = Field(Integer)
    source = Field(Integer)
    using_options(shortnames=True)
    using_table_options(mysql_engine="InnoDB")
    
    def to_thrift_object(self):
        '''
        Returns the thrift object corresponding to this dashboard user object.
        Doesn't set the password in the object being returned.
        '''
        t_dashboard_user = TDashboardUser()
        t_dashboard_user.username = self.username
        t_dashboard_user.role = self.role
        t_dashboard_user.warehouseId = self.warehouseId
        t_dashboard_user.source = self.source
        return t_dashboard_user