Commit c10e71f4b0c7a954ad8a20c566b3b84c672af7cc
1 parent
24f55cde
Exists in
master
Document the models.
Showing
1 changed file
with
32 additions
and
22 deletions
Show diff stats
flaskr/models.py
... | ... | @@ -3,9 +3,40 @@ from flask_login import UserMixin, AnonymousUserMixin |
3 | 3 | from werkzeug.security import generate_password_hash, check_password_hash |
4 | 4 | import enum |
5 | 5 | |
6 | + | |
7 | +# These are not the emission "models" in the scientific meaning of the word. | |
8 | +# They are the SQL Database Models. | |
9 | +# These are also named Entities, in other conventions (we're following flasks") | |
10 | +# If you're looking for the Emission Models (aka scaling laws), | |
11 | +# look in `flaskr/laws/`. | |
12 | + | |
13 | + | |
6 | 14 | db = SQLAlchemy() |
7 | 15 | |
8 | 16 | |
17 | +class StatusEnum(enum.Enum): | |
18 | + pending = 'pending' | |
19 | + success = 'success' | |
20 | + failed = 'failed' | |
21 | + | |
22 | + | |
23 | +class Estimation(db.Model): | |
24 | + id = db.Column(db.Integer(), primary_key=True) | |
25 | + email = db.Column(db.Unicode(1024)) | |
26 | + first_name = db.Column(db.Unicode(1024)) # Antoine | |
27 | + last_name = db.Column(db.Unicode(1024)) # Goutenoir | |
28 | + status = db.Column(db.Enum(StatusEnum)) | |
29 | + | |
30 | + # City, Country | |
31 | + # One address per line | |
32 | + origin_addresses = db.Column(db.Unicode()) | |
33 | + destination_addresses = db.Column(db.Unicode()) | |
34 | + | |
35 | + compute_optimal_destination = db.Column(db.Boolean()) | |
36 | + | |
37 | + | |
38 | +# USERS ####################################################################### | |
39 | + | |
9 | 40 | class User(db.Model, UserMixin): |
10 | 41 | id = db.Column(db.Integer(), primary_key=True) |
11 | 42 | username = db.Column(db.String()) |
... | ... | @@ -41,25 +72,4 @@ class User(db.Model, UserMixin): |
41 | 72 | return self.id |
42 | 73 | |
43 | 74 | def __repr__(self): |
44 | - return '<User %r>' % self.username | |
45 | - | |
46 | - | |
47 | -class StatusEnum(enum.Enum): | |
48 | - pending = 'pending' | |
49 | - success = 'success' | |
50 | - failed = 'failed' | |
51 | - | |
52 | - | |
53 | -class Estimation(db.Model): | |
54 | - id = db.Column(db.Integer(), primary_key=True) | |
55 | - email = db.Column(db.Unicode(1024)) | |
56 | - first_name = db.Column(db.Unicode(1024)) # Antoine | |
57 | - last_name = db.Column(db.Unicode(1024)) # Goutenoir | |
58 | - status = db.Column(db.Enum(StatusEnum)) | |
59 | - | |
60 | - # City, Country | |
61 | - # One address per line | |
62 | - origin_addresses = db.Column(db.Unicode()) | |
63 | - destination_addresses = db.Column(db.Unicode()) | |
64 | - | |
65 | - compute_optimal_destination = db.Column(db.Boolean()) | |
75 | + return '<User %r>' % self.username | |
66 | 76 | \ No newline at end of file | ... | ... |