| 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
|
| 14039 |
kshitij.so |
9 |
|
|
|
10 |
|
|
|
11 |
class Users(Entity):
|
|
|
12 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
13 |
username = Field(String(128))
|
|
|
14 |
email = Field(String(128))
|
|
|
15 |
password = Field(String(64))
|
|
|
16 |
first_name = Field(String(64))
|
|
|
17 |
last_name = Field(String(64))
|
|
|
18 |
mobile_number = Field(String(15))
|
|
|
19 |
referral_url = Field(String(256))
|
|
|
20 |
referrer = Field(String(32))
|
|
|
21 |
password_reset = Field(String(64))
|
|
|
22 |
activation_code = Field(String(40))
|
|
|
23 |
group_id = Field(Integer(unsigned=True), default=1, server_default='1')
|
|
|
24 |
status = Field(Boolean, default=True, server_default='1')
|
|
|
25 |
created = Field(DateTime)
|
|
|
26 |
modified = Field(DateTime)
|
| 15131 |
manish.sha |
27 |
userGroupId = Field(Integer)
|
| 14039 |
kshitij.so |
28 |
using_options(shortnames=True)
|
|
|
29 |
using_table_options(mysql_engine="InnoDB")
|
|
|
30 |
|
|
|
31 |
class user_actions(Entity):
|
|
|
32 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
33 |
user_id = Field(Integer(unsigned=True))
|
|
|
34 |
store_product_id = Field(Integer(unsigned=True))
|
|
|
35 |
action = Field(Enum('like','dislike'))
|
|
|
36 |
created = Field(DateTime)
|
|
|
37 |
using_options(shortnames=True)
|
|
|
38 |
using_table_options(mysql_engine="InnoDB")
|
|
|
39 |
|
|
|
40 |
class brand_preferences(Entity):
|
|
|
41 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
42 |
user_id = Field(Integer(unsigned=True))
|
|
|
43 |
category_id = Field(Integer(unsigned=True))
|
|
|
44 |
brand = Field(String(128))
|
|
|
45 |
status = Field(Enum('show','hide'),default='hide', server_default='hide')
|
|
|
46 |
created = Field(DateTime)
|
|
|
47 |
modified = Field(DateTime)
|
|
|
48 |
using_options(shortnames=True)
|
|
|
49 |
using_table_options(mysql_engine="InnoDB")
|
|
|
50 |
|
|
|
51 |
class price_preferences(Entity):
|
|
|
52 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
53 |
user_id = Field(Integer(unsigned=True))
|
|
|
54 |
category_id = Field(Integer(unsigned=True))
|
|
|
55 |
min_price = Field(Float, default=0.0, server_default="0.0")
|
|
|
56 |
max_price = Field(Float, default=0.0, server_default="0.0")
|
|
|
57 |
created = Field(DateTime)
|
|
|
58 |
modified = Field(DateTime)
|
|
|
59 |
using_options(shortnames=True)
|
|
|
60 |
using_table_options(mysql_engine="InnoDB")
|
|
|
61 |
|
| 14769 |
kshitij.so |
62 |
class Brands(Entity):
|
|
|
63 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
64 |
name = Field(String(128))
|
|
|
65 |
category_id = Field(Integer)
|
|
|
66 |
using_options(shortnames=True)
|
|
|
67 |
using_table_options(mysql_engine="InnoDB")
|
| 14859 |
manish.sha |
68 |
|
| 14921 |
manish.sha |
69 |
class Feedbacks(Entity):
|
| 14859 |
manish.sha |
70 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
71 |
user_id = Field(Integer(unsigned=True))
|
|
|
72 |
email = Field(String(128))
|
|
|
73 |
subject = Field(String(256))
|
|
|
74 |
message = Field(Text)
|
|
|
75 |
created = Field(DateTime)
|
|
|
76 |
isTicketCreated = Field(Boolean, default=False, server_default='0')
|
| 14921 |
manish.sha |
77 |
using_options(shortnames=True)
|
|
|
78 |
using_table_options(mysql_engine="InnoDB")
|
| 14039 |
kshitij.so |
79 |
|
| 15011 |
amit.gupta |
80 |
class Postoffices(Entity):
|
|
|
81 |
id = Field(Integer(10, unsigned=True), primary_key=True)
|
|
|
82 |
name = Field(String(128))
|
|
|
83 |
pincode = Field(Integer(6, unsigned=True))
|
|
|
84 |
deliverystatus = Field(Boolean)
|
|
|
85 |
divisionname = Field(String(128))
|
|
|
86 |
regionname = Field(String(128))
|
|
|
87 |
taluk = Field(String(128))
|
|
|
88 |
district = Field(String(128))
|
|
|
89 |
state = Field(String(128))
|
|
|
90 |
using_options(shortnames=True)
|
|
|
91 |
using_table_options(mysql_engine="InnoDB")
|
|
|
92 |
|
| 15048 |
kshitij.so |
93 |
class Orders(Entity):
|
|
|
94 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
95 |
user_id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
96 |
store_id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
97 |
order_url = Field(String(256))
|
|
|
98 |
status = Field(String(32))
|
|
|
99 |
created = Field(DateTime)
|
|
|
100 |
modified = Field(DateTime)
|
|
|
101 |
using_options(shortnames=True)
|
|
|
102 |
using_table_options(mysql_engine="InnoDB")
|
|
|
103 |
|
| 15081 |
amit.gupta |
104 |
class Retailers(Entity):
|
|
|
105 |
id = Field(Integer(unsigned=True), primary_key=True)
|
| 15083 |
amit.gupta |
106 |
identifier = Field(String(128))
|
| 15081 |
amit.gupta |
107 |
title = Field(String(256))
|
|
|
108 |
address = Field(String(512))
|
|
|
109 |
agent_id=Field(Integer(unsigned=True))
|
|
|
110 |
contact1 = Field(String(10))
|
|
|
111 |
contact2 = Field(String(10))
|
|
|
112 |
pin = Field(String(6))
|
|
|
113 |
state = Field(String(48))
|
|
|
114 |
status = Field(String(20))
|
| 15083 |
amit.gupta |
115 |
is_elavated = Field(Boolean)
|
| 15086 |
amit.gupta |
116 |
retry_count = Field(Integer(3))
|
|
|
117 |
invalid_retry_count = Field(Integer(3))
|
| 15081 |
amit.gupta |
118 |
call_priority = Field(Enum('user_initiated', 'system_initiated'))
|
|
|
119 |
next_call_time = Field(DateTime)
|
| 15086 |
amit.gupta |
120 |
is_std = Field(Boolean)
|
|
|
121 |
is_or = Field(Boolean)
|
| 15081 |
amit.gupta |
122 |
created = Field(DateTime)
|
| 15110 |
amit.gupta |
123 |
disposition = Field(String(32))
|
| 15099 |
amit.gupta |
124 |
modified = Field(DateTime, default=func.now(), onupdate=func.now())
|
| 15081 |
amit.gupta |
125 |
using_options(shortnames=True)
|
|
|
126 |
using_table_options(mysql_engine="InnoDB")
|
|
|
127 |
|
| 15096 |
amit.gupta |
128 |
class CallHistory(Entity):
|
|
|
129 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
130 |
retailer_id = Field(Integer(unsigned=True))
|
|
|
131 |
agent_id = Field(Integer(unsigned=True))
|
|
|
132 |
mobile_number = Field(String(10))
|
| 15113 |
amit.gupta |
133 |
call_type = Field(String(10))
|
| 15096 |
amit.gupta |
134 |
sms_verified = Field(Boolean)
|
|
|
135 |
call_time = Field(DateTime)
|
|
|
136 |
duration_sec = Field(Integer)
|
| 15110 |
amit.gupta |
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'))
|
| 15096 |
amit.gupta |
138 |
disposition_description = Field(String(192))
|
|
|
139 |
created = Field(DateTime,default=func.now())
|
| 15110 |
amit.gupta |
140 |
using_options(shortnames=True)
|
|
|
141 |
using_table_options(mysql_engine="InnoDB")
|
| 15096 |
amit.gupta |
142 |
|
| 15081 |
amit.gupta |
143 |
class RetryConfig(Entity):
|
|
|
144 |
call_type = Field(Enum('fresh', 'followup'))
|
| 15096 |
amit.gupta |
145 |
disposition_type = Field(Enum('ringing_no_answer', 'not_reachable'))
|
| 15081 |
amit.gupta |
146 |
retry_count = Field(Integer(unsigned=True))
|
| 15110 |
amit.gupta |
147 |
minutes_ahead = Field(Integer(unsigned=True))
|
| 15081 |
amit.gupta |
148 |
using_options(shortnames=True)
|
|
|
149 |
using_table_options(mysql_engine="InnoDB")
|
| 15133 |
amit.gupta |
150 |
|
|
|
151 |
class RetailerLinks(Entity):
|
|
|
152 |
retailer_id = Field(Integer(unsigned=True))
|
| 15138 |
amit.gupta |
153 |
agent_id = Field(Integer(unsigned=True))
|
| 15133 |
amit.gupta |
154 |
code = Field(String(10), unique=True)
|
|
|
155 |
is_activated = Field(Boolean)
|
|
|
156 |
activated = Field(DateTime,onupdate=func.now())
|
|
|
157 |
created = Field(DateTime,default=func.now())
|
|
|
158 |
using_options(shortnames=True)
|
|
|
159 |
using_table_options(mysql_engine="InnoDB")
|
| 15135 |
amit.gupta |
160 |
|
|
|
161 |
class Activation_Codes(Entity):
|
|
|
162 |
code = Field(String(10))
|
| 15138 |
amit.gupta |
163 |
created = Field(DateTime, default=func.now())
|
| 15144 |
amit.gupta |
164 |
using_options(shortnames=True)
|
|
|
165 |
using_table_options(mysql_engine="InnoDB")
|
| 15081 |
amit.gupta |
166 |
|
| 15189 |
manas |
167 |
class Agents(Entity):
|
|
|
168 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
169 |
name = Field(String(64))
|
|
|
170 |
email = Field(String(100))
|
|
|
171 |
password = Field(String(64))
|
|
|
172 |
type = Field(Enum('crm','fos'))
|
|
|
173 |
last_login = Field(DateTime)
|
|
|
174 |
created = Field(DateTime, default=func.now())
|
|
|
175 |
using_options(shortnames=True)
|
|
|
176 |
using_table_options(mysql_engine="InnoDB")
|
|
|
177 |
|
|
|
178 |
class Agent_Roles(Entity):
|
|
|
179 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
180 |
agent_id = Field(Integer(unsigned=True))
|
|
|
181 |
role = Field(Enum('fresh','followup','onboarding'))
|
|
|
182 |
created = Field(DateTime, default=func.now())
|
|
|
183 |
using_options(shortnames=True)
|
|
|
184 |
using_table_options(mysql_engine="InnoDB")
|
| 15081 |
amit.gupta |
185 |
|
| 15189 |
manas |
186 |
class AgentLoginTimings(Entity):
|
|
|
187 |
id = Field(Integer(unsigned=True), primary_key=True)
|
|
|
188 |
agent_id = Field(Integer(unsigned=True))
|
|
|
189 |
role = Field(Enum('fresh','followup','onboarding'))
|
|
|
190 |
loginTime = Field(DateTime)
|
|
|
191 |
logoutTime = Field(DateTime)
|
|
|
192 |
created = Field(DateTime, default=func.now())
|
|
|
193 |
using_options(shortnames=True)
|
|
|
194 |
using_table_options(mysql_engine="InnoDB")
|
|
|
195 |
|
| 14826 |
kshitij.so |
196 |
def initialize(dbname='dtr', db_hostname="localhost", echo=True):
|
| 14039 |
kshitij.so |
197 |
#metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
|
|
|
198 |
#metadata.bind = 'mysql://root:shop2020@localhost/catalog'
|
|
|
199 |
cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
|
|
|
200 |
metadata.bind = cengine
|
| 14826 |
kshitij.so |
201 |
metadata.bind.echo = echo
|
| 14039 |
kshitij.so |
202 |
setup_all(True)
|
|
|
203 |
|
|
|
204 |
if __name__=="__main__":
|
|
|
205 |
initialize()
|
| 15011 |
amit.gupta |
206 |
|
|
|
207 |
|
|
|
208 |
|