| 2445 |
chandransh |
1 |
'''
|
|
|
2 |
Created on 05-Jul-2011
|
|
|
3 |
|
|
|
4 |
@author: ashish
|
|
|
5 |
'''
|
|
|
6 |
|
|
|
7 |
from elixir.entity import Entity
|
|
|
8 |
from elixir.fields import Field
|
|
|
9 |
from sqlalchemy.types import String, Integer, DateTime, Boolean
|
|
|
10 |
from elixir.options import using_options, using_table_options
|
|
|
11 |
|
|
|
12 |
from shop2020.thriftpy.utils.ttypes import DashboardUser as TDashboardUser
|
|
|
13 |
|
|
|
14 |
class DashboardUser(Entity):
|
|
|
15 |
username = Field(String(30), primary_key=True)
|
|
|
16 |
password = Field(String(30))
|
|
|
17 |
warehouseId = Field(Integer)
|
|
|
18 |
addedOn = Field(DateTime)
|
|
|
19 |
loggedOn = Field(DateTime)
|
|
|
20 |
status = Field(Integer)
|
|
|
21 |
otherInfo = Field(String(200))
|
|
|
22 |
isAdmin = Field(Boolean)
|
|
|
23 |
using_options(shortnames=True)
|
|
|
24 |
using_table_options(mysql_engine="InnoDB")
|
|
|
25 |
|
|
|
26 |
def to_thrift_object(self):
|
|
|
27 |
'''
|
|
|
28 |
Returns the thrift object corresponding to this dashboard user object.
|
|
|
29 |
Doesn't set the password in the object being returned.
|
|
|
30 |
'''
|
|
|
31 |
t_dashboard_user = TDashboardUser()
|
|
|
32 |
t_dashboard_user.username = self.username
|
|
|
33 |
t_dashboard_user.admin = self.isAdmin
|
|
|
34 |
t_dashboard_user.warehouseId = self.warehouseId
|
|
|
35 |
return t_dashboard_user
|