diff --git a/flaskr/models.py b/flaskr/models.py index cf0541d..61fe9b0 100755 --- a/flaskr/models.py +++ b/flaskr/models.py @@ -1,9 +1,9 @@ +from flaskr.core import generate_unique_id from flask_sqlalchemy import SQLAlchemy from flask_login import UserMixin, AnonymousUserMixin from werkzeug.security import generate_password_hash, check_password_hash import enum - # These are not the emission "models" in the scientific meaning of the word. # They are the SQL Database Models. # These are also named Entities, in other conventions (we're following flasks") @@ -22,10 +22,15 @@ class StatusEnum(enum.Enum): class Estimation(db.Model): id = db.Column(db.Integer(), primary_key=True) + public_id = db.Column( + db.Unicode(), + default=lambda: generate_unique_id(), + unique=True + ) email = db.Column(db.Unicode(1024)) first_name = db.Column(db.Unicode(1024)) # Antoine last_name = db.Column(db.Unicode(1024)) # Goutenoir - status = db.Column(db.Enum(StatusEnum)) + status = db.Column(db.Enum(StatusEnum), default=StatusEnum.pending) # City, Country # One address per line @@ -34,6 +39,10 @@ class Estimation(db.Model): compute_optimal_destination = db.Column(db.Boolean()) + output_as_yaml = db.Column(db.UnicodeText()) + warnings = db.Column(db.UnicodeText()) + errors = db.Column(db.UnicodeText()) + # USERS ####################################################################### @@ -72,4 +81,4 @@ class User(db.Model, UserMixin): return self.id def __repr__(self): - return '' % self.username \ No newline at end of file + return '' % self.username -- libgit2 0.21.2