| Line 4... |
Line 4... |
| 4 |
from elixir.fields import Field
|
4 |
from elixir.fields import Field
|
| 5 |
from elixir.options import using_options, using_table_options
|
5 |
from elixir.options import using_options, using_table_options
|
| 6 |
from sqlalchemy.sql.expression import func
|
6 |
from sqlalchemy.sql.expression import func
|
| 7 |
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Enum, \
|
7 |
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Enum, \
|
| 8 |
Text
|
8 |
Text
|
| - |
|
9 |
from sqlalchemy.dialects.mysql.base import LONGTEXT
|
| 9 |
|
10 |
|
| 10 |
|
11 |
|
| 11 |
class Users(Entity):
|
12 |
class Users(Entity):
|
| 12 |
id = Field(Integer(unsigned=True), primary_key=True)
|
13 |
id = Field(Integer(unsigned=True), primary_key=True)
|
| 13 |
username = Field(String(128))
|
14 |
username = Field(String(128))
|
| Line 99... |
Line 100... |
| 99 |
created = Field(DateTime)
|
100 |
created = Field(DateTime)
|
| 100 |
modified = Field(DateTime)
|
101 |
modified = Field(DateTime)
|
| 101 |
using_options(shortnames=True)
|
102 |
using_options(shortnames=True)
|
| 102 |
using_table_options(mysql_engine="InnoDB")
|
103 |
using_table_options(mysql_engine="InnoDB")
|
| 103 |
|
104 |
|
| - |
|
105 |
class OrdersRaw(Entity):
|
| - |
|
106 |
id = Field(Integer(unsigned=True), primary_key=True)
|
| - |
|
107 |
user_id = Field(Integer(unsigned=True), primary_key=True)
|
| - |
|
108 |
store_id = Field(Integer(unsigned=True), primary_key=True)
|
| - |
|
109 |
order_url = Field(String(256))
|
| - |
|
110 |
raw_html = Field(LONGTEXT)
|
| - |
|
111 |
status = Field(String(32))
|
| - |
|
112 |
created = Field(DateTime)
|
| - |
|
113 |
modified = Field(DateTime)
|
| - |
|
114 |
using_options(tablename="orders")
|
| - |
|
115 |
using_table_options(mysql_engine="InnoDB")
|
| - |
|
116 |
|
| 104 |
class Retailers(Entity):
|
117 |
class Retailers(Entity):
|
| 105 |
id = Field(Integer(unsigned=True), primary_key=True)
|
118 |
id = Field(Integer(unsigned=True), primary_key=True)
|
| 106 |
identifier = Field(String(128))
|
119 |
identifier = Field(String(128))
|
| 107 |
title = Field(String(256))
|
120 |
title = Field(String(256))
|
| 108 |
address = Field(String(512))
|
121 |
address = Field(String(512))
|
| Line 132... |
Line 145... |
| 132 |
mobile_number = Field(String(10))
|
145 |
mobile_number = Field(String(10))
|
| 133 |
call_type = Field(String(10))
|
146 |
call_type = Field(String(10))
|
| 134 |
sms_verified = Field(Boolean)
|
147 |
sms_verified = Field(Boolean)
|
| 135 |
call_time = Field(DateTime)
|
148 |
call_time = Field(DateTime)
|
| 136 |
duration_sec = Field(Integer)
|
149 |
duration_sec = Field(Integer)
|
| - |
|
150 |
last_fetch_time = Field(DateTime)
|
| 137 |
call_disposition = Field(Enum('call_later','ringing_no_answer', 'not_reachable', 'switch_off', 'invalid_no', 'wrong_no', 'hang_up','retailer_not_interested', 'alreadyuser', 'verified_link_sent'))
|
151 |
call_disposition = Field(Enum('call_later','ringing_no_answer', 'not_reachable', 'switch_off', 'invalid_no', 'wrong_no', 'hang_up','retailer_not_interested', 'alreadyuser', 'verified_link_sent'))
|
| 138 |
disposition_description = Field(String(192))
|
152 |
disposition_description = Field(String(192))
|
| 139 |
disposition_comments = Field(String(192))
|
153 |
disposition_comments = Field(String(192))
|
| 140 |
created = Field(DateTime,default=func.now())
|
154 |
created = Field(DateTime,default=func.now())
|
| 141 |
using_options(shortnames=True)
|
155 |
using_options(shortnames=True)
|
| Line 148... |
Line 162... |
| 148 |
minutes_ahead = Field(Integer(unsigned=True))
|
162 |
minutes_ahead = Field(Integer(unsigned=True))
|
| 149 |
using_options(shortnames=True)
|
163 |
using_options(shortnames=True)
|
| 150 |
using_table_options(mysql_engine="InnoDB")
|
164 |
using_table_options(mysql_engine="InnoDB")
|
| 151 |
|
165 |
|
| 152 |
class RetailerLinks(Entity):
|
166 |
class RetailerLinks(Entity):
|
| - |
|
167 |
id = Field(Integer(unsigned=True), primary_key=True)
|
| 153 |
retailer_id = Field(Integer(unsigned=True))
|
168 |
retailer_id = Field(Integer(unsigned=True))
|
| 154 |
agent_id = Field(Integer(unsigned=True))
|
169 |
agent_id = Field(Integer(unsigned=True))
|
| 155 |
code = Field(String(10), unique=True)
|
170 |
code = Field(String(10), unique=True)
|
| 156 |
is_activated = Field(Boolean)
|
171 |
is_activated = Field(Boolean)
|
| 157 |
activated = Field(DateTime,onupdate=func.now())
|
172 |
activated = Field(DateTime,onupdate=func.now())
|
| Line 192... |
Line 207... |
| 192 |
logoutTime = Field(DateTime)
|
207 |
logoutTime = Field(DateTime)
|
| 193 |
created = Field(DateTime, default=func.now())
|
208 |
created = Field(DateTime, default=func.now())
|
| 194 |
using_options(shortnames=True)
|
209 |
using_options(shortnames=True)
|
| 195 |
using_table_options(mysql_engine="InnoDB")
|
210 |
using_table_options(mysql_engine="InnoDB")
|
| 196 |
|
211 |
|
| - |
|
212 |
class FetchDataHistory(Entity):
|
| - |
|
213 |
id = Field(Integer(unsigned=True), primary_key=True)
|
| - |
|
214 |
retailer_id = Field(Integer(unsigned=True))
|
| - |
|
215 |
agent_id = Field(Integer(unsigned=True))
|
| - |
|
216 |
call_type = Field(String(10))
|
| - |
|
217 |
last_action = Field(Enum('login','disposition'))
|
| - |
|
218 |
last_action_time = Field(DateTime)
|
| - |
|
219 |
created = Field(DateTime,default=func.now())
|
| - |
|
220 |
using_options(shortnames=True)
|
| - |
|
221 |
using_table_options(mysql_engine="InnoDB")
|
| - |
|
222 |
|
| 197 |
def initialize(dbname='dtr', db_hostname="localhost", echo=True):
|
223 |
def initialize(dbname='dtr', db_hostname="localhost", echo=True):
|
| 198 |
#metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
|
224 |
#metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
|
| 199 |
#metadata.bind = 'mysql://root:shop2020@localhost/catalog'
|
225 |
#metadata.bind = 'mysql://root:shop2020@localhost/catalog'
|
| 200 |
cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
|
226 |
cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
|
| 201 |
metadata.bind = cengine
|
227 |
metadata.bind = cengine
|