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