| 15086 |
amit.gupta |
1 |
from sqlalchemy import create_engine
|
| 15011 |
amit.gupta |
2 |
from elixir import *
|
| 14039 |
kshitij.so |
3 |
from elixir.entity import Entity
|
|
|
4 |
from elixir.fields import Field
|
|
|
5 |
from elixir.options import using_options, using_table_options
|
| 15081 |
amit.gupta |
6 |
from sqlalchemy.sql.expression import func
|
| 15011 |
amit.gupta |
7 |
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Enum, \
|
|
|
8 |
Text
|
| 15234 |
amit.gupta |
9 |
from sqlalchemy.dialects.mysql.base import LONGTEXT
|
| 14039 |
kshitij.so |
10 |
|
|
|
11 |
|
|
|
12 |
class Users(Entity):
|
|
|
13 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
14 |
username = Field(String(128))
|
|
|
15 |
email = Field(String(128))
|
|
|
16 |
password = Field(String(64))
|
|
|
17 |
first_name = Field(String(64))
|
|
|
18 |
last_name = Field(String(64))
|
|
|
19 |
mobile_number = Field(String(15))
|
|
|
20 |
referral_url = Field(String(256))
|
|
|
21 |
referrer = Field(String(32))
|
|
|
22 |
password_reset = Field(String(64))
|
|
|
23 |
activation_code = Field(String(40))
|
| 15393 |
amit.gupta |
24 |
activated = Field(Boolean)
|
| 14039 |
kshitij.so |
25 |
group_id = Field(Integer(unsigned=True), default=1, server_default='1')
|
|
|
26 |
status = Field(Boolean, default=True, server_default='1')
|
| 15245 |
manas |
27 |
utm_campaign = Field(String(128))
|
| 15365 |
amit.gupta |
28 |
activation_time = Field(DateTime)
|
| 14039 |
kshitij.so |
29 |
created = Field(DateTime)
|
|
|
30 |
modified = Field(DateTime)
|
| 15191 |
manish.sha |
31 |
usergroup_id = Field(Text)
|
| 14039 |
kshitij.so |
32 |
using_options(shortnames=True)
|
|
|
33 |
using_table_options(mysql_engine="InnoDB")
|
|
|
34 |
|
|
|
35 |
class user_actions(Entity):
|
|
|
36 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
37 |
user_id = Field(Integer(unsigned=True))
|
|
|
38 |
store_product_id = Field(Integer(unsigned=True))
|
|
|
39 |
action = Field(Enum('like','dislike'))
|
| 15392 |
amit.gupta |
40 |
created = Field(DateTime, default=func.now())
|
| 14039 |
kshitij.so |
41 |
using_options(shortnames=True)
|
|
|
42 |
using_table_options(mysql_engine="InnoDB")
|
| 15369 |
amit.gupta |
43 |
|
|
|
44 |
class OnboardedRetailerChecklists(Entity):
|
|
|
45 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
46 |
retailer_id = Field(Integer(unsigned=True))
|
|
|
47 |
number_verification = Field(Boolean)
|
|
|
48 |
preferences = Field(Boolean)
|
|
|
49 |
doa_return_policy = Field(Boolean)
|
|
|
50 |
payment_option = Field(Boolean)
|
|
|
51 |
contact_us = Field(Boolean)
|
| 15371 |
amit.gupta |
52 |
product_info = Field(Boolean)
|
|
|
53 |
redeem = Field(Boolean)
|
| 15392 |
amit.gupta |
54 |
created = Field(DateTime,default=func.now())
|
| 15369 |
amit.gupta |
55 |
using_options(shortnames=True)
|
|
|
56 |
using_table_options(mysql_engine="InnoDB")
|
| 14039 |
kshitij.so |
57 |
|
|
|
58 |
class brand_preferences(Entity):
|
|
|
59 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
60 |
user_id = Field(Integer(unsigned=True))
|
|
|
61 |
category_id = Field(Integer(unsigned=True))
|
|
|
62 |
brand = Field(String(128))
|
|
|
63 |
status = Field(Enum('show','hide'),default='hide', server_default='hide')
|
|
|
64 |
created = Field(DateTime)
|
|
|
65 |
modified = Field(DateTime)
|
|
|
66 |
using_options(shortnames=True)
|
|
|
67 |
using_table_options(mysql_engine="InnoDB")
|
|
|
68 |
|
|
|
69 |
class price_preferences(Entity):
|
|
|
70 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
71 |
user_id = Field(Integer(unsigned=True))
|
|
|
72 |
category_id = Field(Integer(unsigned=True))
|
|
|
73 |
min_price = Field(Float, default=0.0, server_default="0.0")
|
|
|
74 |
max_price = Field(Float, default=0.0, server_default="0.0")
|
|
|
75 |
created = Field(DateTime)
|
|
|
76 |
modified = Field(DateTime)
|
|
|
77 |
using_options(shortnames=True)
|
|
|
78 |
using_table_options(mysql_engine="InnoDB")
|
|
|
79 |
|
| 14769 |
kshitij.so |
80 |
class Brands(Entity):
|
|
|
81 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
82 |
name = Field(String(128))
|
|
|
83 |
category_id = Field(Integer)
|
|
|
84 |
using_options(shortnames=True)
|
|
|
85 |
using_table_options(mysql_engine="InnoDB")
|
| 14859 |
manish.sha |
86 |
|
| 14921 |
manish.sha |
87 |
class Feedbacks(Entity):
|
| 14859 |
manish.sha |
88 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
89 |
user_id = Field(Integer(unsigned=True))
|
|
|
90 |
email = Field(String(128))
|
|
|
91 |
subject = Field(String(256))
|
|
|
92 |
message = Field(Text)
|
|
|
93 |
created = Field(DateTime)
|
|
|
94 |
isTicketCreated = Field(Boolean, default=False, server_default='0')
|
| 14921 |
manish.sha |
95 |
using_options(shortnames=True)
|
|
|
96 |
using_table_options(mysql_engine="InnoDB")
|
| 14039 |
kshitij.so |
97 |
|
| 15011 |
amit.gupta |
98 |
class Postoffices(Entity):
|
|
|
99 |
id = Field(Integer(10, unsigned=True), primary_key=True)
|
|
|
100 |
name = Field(String(128))
|
|
|
101 |
pincode = Field(Integer(6, unsigned=True))
|
|
|
102 |
deliverystatus = Field(Boolean)
|
|
|
103 |
divisionname = Field(String(128))
|
|
|
104 |
regionname = Field(String(128))
|
|
|
105 |
taluk = Field(String(128))
|
|
|
106 |
district = Field(String(128))
|
|
|
107 |
state = Field(String(128))
|
|
|
108 |
using_options(shortnames=True)
|
|
|
109 |
using_table_options(mysql_engine="InnoDB")
|
|
|
110 |
|
| 15048 |
kshitij.so |
111 |
class Orders(Entity):
|
|
|
112 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
113 |
user_id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
114 |
store_id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
115 |
order_url = Field(String(256))
|
|
|
116 |
status = Field(String(32))
|
|
|
117 |
created = Field(DateTime)
|
|
|
118 |
modified = Field(DateTime)
|
|
|
119 |
using_options(shortnames=True)
|
|
|
120 |
using_table_options(mysql_engine="InnoDB")
|
|
|
121 |
|
| 15532 |
amit.gupta |
122 |
class FlipkartOrders(Entity):
|
|
|
123 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
124 |
user_id = Field(Integer(unsigned=True))
|
|
|
125 |
email = Field(String(128))
|
|
|
126 |
subtagId= Field(String(32))
|
|
|
127 |
identifier = Field(String(32))
|
|
|
128 |
catalogId = Field(Integer)
|
|
|
129 |
title = Field(String(128))
|
|
|
130 |
brand = Field(String(64))
|
|
|
131 |
model = Field(String(64))
|
|
|
132 |
status = Field(String(16))
|
|
|
133 |
price = Field(Float)
|
|
|
134 |
category = Field(String(16))
|
|
|
135 |
quantity = Field(SmallInteger)
|
|
|
136 |
created = Field(DateTime)
|
|
|
137 |
modified = Field(DateTime)
|
|
|
138 |
using_options(shortnames=True)
|
|
|
139 |
using_table_options(mysql_engine="InnoDB")
|
|
|
140 |
|
| 15234 |
amit.gupta |
141 |
class OrdersRaw(Entity):
|
|
|
142 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
143 |
user_id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
144 |
store_id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
145 |
order_url = Field(String(256))
|
|
|
146 |
raw_html = Field(LONGTEXT)
|
|
|
147 |
status = Field(String(32))
|
|
|
148 |
created = Field(DateTime)
|
|
|
149 |
modified = Field(DateTime)
|
| 15236 |
amit.gupta |
150 |
using_options(tablename="orders")
|
|
|
151 |
using_table_options(useexisting=True,mysql_engine="InnoDB")
|
| 15234 |
amit.gupta |
152 |
|
| 15081 |
amit.gupta |
153 |
class Retailers(Entity):
|
|
|
154 |
id = Field(Integer(unsigned=True), primary_key=True)
|
| 15083 |
amit.gupta |
155 |
identifier = Field(String(128))
|
| 15081 |
amit.gupta |
156 |
title = Field(String(256))
|
|
|
157 |
address = Field(String(512))
|
| 15254 |
amit.gupta |
158 |
address_new = Field(String(512))
|
| 15081 |
amit.gupta |
159 |
agent_id=Field(Integer(unsigned=True))
|
|
|
160 |
contact1 = Field(String(10))
|
|
|
161 |
contact2 = Field(String(10))
|
|
|
162 |
pin = Field(String(6))
|
| 15254 |
amit.gupta |
163 |
cod_limit = Field(Integer(10))
|
| 15081 |
amit.gupta |
164 |
state = Field(String(48))
|
|
|
165 |
status = Field(String(20))
|
| 15083 |
amit.gupta |
166 |
is_elavated = Field(Boolean)
|
| 15086 |
amit.gupta |
167 |
retry_count = Field(Integer(3))
|
|
|
168 |
invalid_retry_count = Field(Integer(3))
|
| 15081 |
amit.gupta |
169 |
call_priority = Field(Enum('user_initiated', 'system_initiated'))
|
|
|
170 |
next_call_time = Field(DateTime)
|
| 15086 |
amit.gupta |
171 |
is_std = Field(Boolean)
|
|
|
172 |
is_or = Field(Boolean)
|
| 15081 |
amit.gupta |
173 |
created = Field(DateTime)
|
| 15110 |
amit.gupta |
174 |
disposition = Field(String(32))
|
| 15099 |
amit.gupta |
175 |
modified = Field(DateTime, default=func.now(), onupdate=func.now())
|
| 15081 |
amit.gupta |
176 |
using_options(shortnames=True)
|
|
|
177 |
using_table_options(mysql_engine="InnoDB")
|
| 15331 |
amit.gupta |
178 |
|
|
|
179 |
class AlreadyCalledNumbers(Entity):
|
|
|
180 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
181 |
mobile_number = Field(String(10), unique=True)
|
| 15352 |
amit.gupta |
182 |
using_options(shortnames=True)
|
|
|
183 |
using_table_options(mysql_engine="InnoDB")
|
| 15081 |
amit.gupta |
184 |
|
| 15254 |
amit.gupta |
185 |
class RetailerContacts(Entity):
|
|
|
186 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
187 |
retailer_id = Field(Integer(unsigned=True))
|
|
|
188 |
agent_id = Field(Integer(unsigned=True))
|
|
|
189 |
mobile_number = Field(String(10))
|
| 15260 |
amit.gupta |
190 |
contact_type = Field(Enum('sms', 'called', 'ringing'))
|
| 15254 |
amit.gupta |
191 |
call_type = Field(String(10))
|
|
|
192 |
created = Field(DateTime,default=func.now())
|
|
|
193 |
using_options(shortnames=True)
|
|
|
194 |
using_table_options(mysql_engine="InnoDB")
|
|
|
195 |
|
|
|
196 |
|
| 15096 |
amit.gupta |
197 |
class CallHistory(Entity):
|
|
|
198 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
199 |
retailer_id = Field(Integer(unsigned=True))
|
|
|
200 |
agent_id = Field(Integer(unsigned=True))
|
|
|
201 |
mobile_number = Field(String(10))
|
| 15113 |
amit.gupta |
202 |
call_type = Field(String(10))
|
| 15096 |
amit.gupta |
203 |
sms_verified = Field(Boolean)
|
|
|
204 |
call_time = Field(DateTime)
|
|
|
205 |
duration_sec = Field(Integer)
|
| 15234 |
amit.gupta |
206 |
last_fetch_time = Field(DateTime)
|
| 15377 |
amit.gupta |
207 |
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', 'onboarded'))
|
| 15096 |
amit.gupta |
208 |
disposition_description = Field(String(192))
|
| 15201 |
manas |
209 |
disposition_comments = Field(String(192))
|
| 15096 |
amit.gupta |
210 |
created = Field(DateTime,default=func.now())
|
| 15110 |
amit.gupta |
211 |
using_options(shortnames=True)
|
|
|
212 |
using_table_options(mysql_engine="InnoDB")
|
| 15096 |
amit.gupta |
213 |
|
| 15081 |
amit.gupta |
214 |
class RetryConfig(Entity):
|
| 15359 |
amit.gupta |
215 |
call_type = Field(Enum('fresh', 'followup', 'onboarding'))
|
| 15096 |
amit.gupta |
216 |
disposition_type = Field(Enum('ringing_no_answer', 'not_reachable'))
|
| 15081 |
amit.gupta |
217 |
retry_count = Field(Integer(unsigned=True))
|
| 15110 |
amit.gupta |
218 |
minutes_ahead = Field(Integer(unsigned=True))
|
| 15081 |
amit.gupta |
219 |
using_options(shortnames=True)
|
|
|
220 |
using_table_options(mysql_engine="InnoDB")
|
| 15133 |
amit.gupta |
221 |
|
|
|
222 |
class RetailerLinks(Entity):
|
| 15234 |
amit.gupta |
223 |
id = Field(Integer(unsigned=True), primary_key=True)
|
| 15254 |
amit.gupta |
224 |
retailer_id = Field(Integer(unsigned=True), unique=True)
|
| 15138 |
amit.gupta |
225 |
agent_id = Field(Integer(unsigned=True))
|
| 15133 |
amit.gupta |
226 |
code = Field(String(10), unique=True)
|
| 15278 |
amit.gupta |
227 |
mapped_with = Field(String)
|
| 15133 |
amit.gupta |
228 |
activated = Field(DateTime,onupdate=func.now())
|
| 15255 |
amit.gupta |
229 |
user_id = Field(Integer(unsigned=True))
|
| 15133 |
amit.gupta |
230 |
created = Field(DateTime,default=func.now())
|
|
|
231 |
using_options(shortnames=True)
|
|
|
232 |
using_table_options(mysql_engine="InnoDB")
|
| 15135 |
amit.gupta |
233 |
|
|
|
234 |
class Activation_Codes(Entity):
|
|
|
235 |
code = Field(String(10))
|
| 15138 |
amit.gupta |
236 |
created = Field(DateTime, default=func.now())
|
| 15144 |
amit.gupta |
237 |
using_options(shortnames=True)
|
|
|
238 |
using_table_options(mysql_engine="InnoDB")
|
| 15081 |
amit.gupta |
239 |
|
| 15189 |
manas |
240 |
class Agents(Entity):
|
|
|
241 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
242 |
name = Field(String(64))
|
|
|
243 |
email = Field(String(100))
|
|
|
244 |
password = Field(String(64))
|
|
|
245 |
type = Field(Enum('crm','fos'))
|
|
|
246 |
last_login = Field(DateTime)
|
| 15533 |
amit.gupta |
247 |
login_type = Field(String(10))
|
| 15189 |
manas |
248 |
created = Field(DateTime, default=func.now())
|
|
|
249 |
using_options(shortnames=True)
|
|
|
250 |
using_table_options(mysql_engine="InnoDB")
|
|
|
251 |
|
|
|
252 |
class Agent_Roles(Entity):
|
|
|
253 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
254 |
agent_id = Field(Integer(unsigned=True))
|
|
|
255 |
role = Field(Enum('fresh','followup','onboarding'))
|
|
|
256 |
created = Field(DateTime, default=func.now())
|
|
|
257 |
using_options(shortnames=True)
|
|
|
258 |
using_table_options(mysql_engine="InnoDB")
|
| 15081 |
amit.gupta |
259 |
|
| 15189 |
manas |
260 |
class AgentLoginTimings(Entity):
|
|
|
261 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
262 |
agent_id = Field(Integer(unsigned=True))
|
|
|
263 |
role = Field(Enum('fresh','followup','onboarding'))
|
|
|
264 |
loginTime = Field(DateTime)
|
|
|
265 |
logoutTime = Field(DateTime)
|
|
|
266 |
created = Field(DateTime, default=func.now())
|
|
|
267 |
using_options(shortnames=True)
|
|
|
268 |
using_table_options(mysql_engine="InnoDB")
|
| 15424 |
amit.gupta |
269 |
|
|
|
270 |
class Clicks(Entity):
|
|
|
271 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
272 |
user_id = Field(Integer(unsigned=True))
|
|
|
273 |
tag = Field(String(20))
|
|
|
274 |
created = Field(DateTime, default=func.now())
|
|
|
275 |
using_options(shortnames=True)
|
|
|
276 |
using_table_options(mysql_engine="InnoDB")
|
| 15189 |
manas |
277 |
|
| 15234 |
amit.gupta |
278 |
class FetchDataHistory(Entity):
|
|
|
279 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
280 |
retailer_id = Field(Integer(unsigned=True))
|
|
|
281 |
agent_id = Field(Integer(unsigned=True))
|
|
|
282 |
call_type = Field(String(10))
|
|
|
283 |
last_action = Field(Enum('login','disposition'))
|
|
|
284 |
last_action_time = Field(DateTime)
|
|
|
285 |
created = Field(DateTime,default=func.now())
|
|
|
286 |
using_options(shortnames=True)
|
|
|
287 |
using_table_options(mysql_engine="InnoDB")
|
|
|
288 |
|
| 14826 |
kshitij.so |
289 |
def initialize(dbname='dtr', db_hostname="localhost", echo=True):
|
| 14039 |
kshitij.so |
290 |
#metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
|
|
|
291 |
#metadata.bind = 'mysql://root:shop2020@localhost/catalog'
|
|
|
292 |
cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
|
|
|
293 |
metadata.bind = cengine
|
| 14826 |
kshitij.so |
294 |
metadata.bind.echo = echo
|
| 14039 |
kshitij.so |
295 |
setup_all(True)
|
|
|
296 |
|
|
|
297 |
if __name__=="__main__":
|
|
|
298 |
initialize()
|
| 15011 |
amit.gupta |
299 |
|
|
|
300 |
|
|
|
301 |
|