-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
31 lines (24 loc) · 872 Bytes
/
models.py
File metadata and controls
31 lines (24 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from core import app
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
db = SQLAlchemy(app)
migrate = Migrate(app, db)
# user table
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
token = db.Column(db.String(50), unique=True)
name = db.Column(db.String(50))
password = db.Column(db.String(128))
admin = db.Column(db.Boolean)
class LogLag(db.Model):
id = db.Column(db.Integer, primary_key=True)
logitude = db.Column(db.Float(128))
latitude = db.Column(db.Float(128))
def __init__(self, logitude, latitude):
self.logitude = logitude
self.latitude = latitude
class Upload(db.Model):
id = db.Column(db.Integer, primary_key=True)
file = db.Column(db.Text, nullable=False)
name = db.Column(db.Text, nullable=False)
mimetype = db.Column(db.Text, nullable=False)