Subversion Repositories SmartDukaan

Rev

Rev 5283 | Rev 5469 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5283 Rev 5326
Line 11... Line 11...
11
from sqlalchemy.types import Integer
11
from sqlalchemy.types import Integer
12
from elixir.relationships import OneToMany, ManyToOne
12
from elixir.relationships import OneToMany, ManyToOne
13
import datetime
13
import datetime
14
import elixir
14
import elixir
15
 
15
 
16
class SocialService(Entity):
-
 
17
    id = Field(Integer, primary_key=True, autoincrement=True)
-
 
18
    name = Field(String(100))
-
 
19
    handles = OneToMany("SocialHandle")
-
 
20
    using_options(shortnames=True)
-
 
21
    using_table_options(mysql_engine="InnoDB")
-
 
22
    
-
 
23
class SocialHandle(Entity):
-
 
24
    id = Field(Integer, primary_key=True, autoincrement=True)
-
 
25
    handle = Field(String(100))
-
 
26
    service = ManyToOne("SocialService")
-
 
27
    user = ManyToOne("User")
-
 
28
    using_options(shortnames=True)
-
 
29
    using_table_options(mysql_engine="InnoDB")
-
 
30
        
-
 
31
class Address(Entity):
16
class Address(Entity):
32
    id = Field(Integer, primary_key=True, autoincrement=True)
17
    id = Field(Integer, primary_key=True, autoincrement=True)
33
    line_1 = Field(String(100))
18
    line_1 = Field(String(100))
34
    line_2 = Field(String(100))
19
    line_2 = Field(String(100))
35
    landmark = Field(String(100))
20
    landmark = Field(String(100))
Line 44... Line 29...
44
    phone = Field(String(20))
29
    phone = Field(String(20))
45
    user = ManyToOne("User")
30
    user = ManyToOne("User")
46
    using_options(shortnames=True)
31
    using_options(shortnames=True)
47
    using_table_options(mysql_engine="InnoDB")
32
    using_table_options(mysql_engine="InnoDB")
48
        
33
        
49
class Phone(Entity):
-
 
50
    id = Field(Integer, primary_key=True, autoincrement=True)
-
 
51
    country_code = Field(String(5))
-
 
52
    area_code = Field(String(10))
-
 
53
    number = Field(String(20))
-
 
54
    extension = Field(String(10))
-
 
55
    type = Field(Integer)
-
 
56
    user = ManyToOne("User")
-
 
57
    using_options(shortnames=True)
-
 
58
    using_table_options(mysql_engine="InnoDB")
-
 
59
    
-
 
60
class InternalInfo(Entity):
-
 
61
    id = Field(Integer, primary_key=True, autoincrement=True)
-
 
62
    geo_zone = Field(Integer)
-
 
63
    shipment_zone = Field(Integer)
-
 
64
    tax_zone = Field(Integer)
-
 
65
    rank_score = Field(Float)
-
 
66
    user = ManyToOne("User")
-
 
67
    using_options(shortnames=True)
-
 
68
    using_table_options(mysql_engine="InnoDB")
-
 
69
        
-
 
70
class IPMap(Entity):
-
 
71
    id = Field(Integer, primary_key=True, autoincrement=True)
-
 
72
    timestamp = Field(DateTime)
-
 
73
    ip = Field(String(30))
-
 
74
    user_state = ManyToOne("UserState")
-
 
75
    using_options(shortnames=True)
-
 
76
    using_table_options(mysql_engine="InnoDB")
-
 
77
        
-
 
78
class UserState(Entity):
-
 
79
    id = Field(Integer, primary_key=True, autoincrement=True)
-
 
80
    last_login = Field(DateTime)
-
 
81
    last_logout = Field(DateTime)
-
 
82
    email_verification_sent_on = Field(DateTime)
-
 
83
    sms_verification_sent_on = Field(DateTime)
-
 
84
    is_email_verified = Field(Boolean)
-
 
85
    is_sms_verified =Field(Boolean)
-
 
86
    active_since = Field(DateTime)
-
 
87
    account_status = Field(Integer)
-
 
88
    ip_list = OneToMany("IPMap")
-
 
89
    user = ManyToOne("User")
-
 
90
    using_options(shortnames=True)
-
 
91
    using_table_options(mysql_engine="InnoDB")
-
 
92
 
-
 
93
class User(Entity):
34
class User(Entity):
94
    id = Field(Integer, primary_key=True, autoincrement=True)
35
    id = Field(Integer, primary_key=True, autoincrement=True)
95
    email = Field(String(100))
36
    email = Field(String(100))
96
    password = Field(String(50))
37
    password = Field(String(50))
97
    name = Field(String(150))
38
    name = Field(String(150))
98
    default_address_id = Field(Integer)
39
    default_address_id = Field(Integer)
99
    communication_email = Field(String(100))
40
    communication_email = Field(String(100))
100
    active_cart_id = Field(Integer)
41
    active_cart = ManyToOne("Cart")
101
    jsession_id = Field(String(64))
42
    jsession_id = Field(String(64))
102
    is_anonymous = Field(Boolean)
43
    is_anonymous = Field(Boolean)
103
    date_of_birth = Field(String(20))
44
    date_of_birth = Field(String(20))
104
    sex = Field(Integer)
45
    sex = Field(Integer)
105
    mobile_number = Field(String(20))
46
    mobile_number = Field(String(20))
106
    source = Field(String(200))
47
    source = Field(String(200))
107
    source_start_time = Field(DateTime)
48
    source_start_time = Field(DateTime)
108
    trust_level = Field(Float)
49
    trust_level = Field(Float)
-
 
50
    last_login = Field(DateTime)
-
 
51
    last_logout = Field(DateTime)
-
 
52
    active_since = Field(DateTime)
109
    addresses = OneToMany("Address")
53
    addresses = OneToMany("Address")
110
    social_handles = OneToMany("SocialHandle")
-
 
111
    using_options(shortnames=True)
54
    using_options(shortnames=True)
112
    using_table_options(mysql_engine="InnoDB")
55
    using_table_options(mysql_engine="InnoDB")
113
 
56
 
114
class Line(Entity):
57
class Line(Entity):
115
    cart = ManyToOne("Cart", primary_key=True)
58
    cart = ManyToOne("Cart", primary_key=True)
Line 125... Line 68...
125
    using_options(shortnames=True)
68
    using_options(shortnames=True)
126
    using_table_options(mysql_engine="InnoDB")
69
    using_table_options(mysql_engine="InnoDB")
127
    
70
    
128
class Cart(Entity):
71
class Cart(Entity):
129
    id = Field(Integer, primary_key=True, autoincrement=True)
72
    id = Field(Integer, primary_key=True, autoincrement=True)
130
    user_id = Field(Integer)
-
 
131
    cart_status = Field(Integer)
73
    cart_status = Field(Integer)
132
    address_id = Field(Integer)
74
    address_id = Field(Integer)
133
    checked_out_on = Field(DateTime)
75
    checked_out_on = Field(DateTime)
134
    created_on = Field(DateTime)
76
    created_on = Field(DateTime)
135
    updated_on = Field(DateTime)
77
    updated_on = Field(DateTime)
136
    lines = OneToMany("Line")
78
    lines = OneToMany("Line")
137
    total_price = Field(Float)
79
    total_price = Field(Float)
138
    discounted_price = Field(Float)
80
    discounted_price = Field(Float)
139
    coupon_code = Field(String(20))
81
    coupon_code = Field(String(20))
-
 
82
    user = OneToMany("User")
140
    using_options(shortnames=True)
83
    using_options(shortnames=True)
141
    using_table_options(mysql_engine="InnoDB")
84
    using_table_options(mysql_engine="InnoDB")
142
 
85
 
143
class Discount(Entity):
86
class Discount(Entity):
144
    line = ManyToOne("Line", primary_key=True)
87
    line = ManyToOne("Line", primary_key=True)