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