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