Commit 97fe903ef2782b4eec87e38fe3bb7b598dbde902

Authored by Goutte
1 parent 7b4d2926
Exists in master

Add the base database model for an estimation request.

Showing 1 changed file with 22 additions and 0 deletions   Show diff stats
flaskr/models.py
1 from flask_sqlalchemy import SQLAlchemy 1 from flask_sqlalchemy import SQLAlchemy
2 from flask_login import UserMixin, AnonymousUserMixin 2 from flask_login import UserMixin, AnonymousUserMixin
3 from werkzeug.security import generate_password_hash, check_password_hash 3 from werkzeug.security import generate_password_hash, check_password_hash
  4 +import enum
4 5
5 db = SQLAlchemy() 6 db = SQLAlchemy()
6 7
@@ -41,3 +42,24 @@ class User(db.Model, UserMixin): @@ -41,3 +42,24 @@ class User(db.Model, UserMixin):
41 42
42 def __repr__(self): 43 def __repr__(self):
43 return '<User %r>' % self.username 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 + # destination_address = db.Column(db.Unicode(1024))
  61 +
  62 + # City, Country
  63 + # One address per line
  64 + origin_addresses = db.Column(db.Unicode())
  65 + destination_addresses = db.Column(db.Unicode())