July 6 - Optimize codes
This commit is contained in:
@@ -5,5 +5,4 @@ from app.models.inspection import (InspectionTemplate, ChecklistItem,
|
||||
from app.models.issue import Issue
|
||||
from app.models.project import Project, CustomerAssignment
|
||||
from app.models.api_token import RefreshToken, DeviceToken
|
||||
from app.models.notification_matrix import NotificationMatrix
|
||||
from app.models.device_registration import DeviceRegistration
|
||||
from app.models.notification_matrix import NotificationMatrix
|
||||
@@ -1,24 +0,0 @@
|
||||
# app/models/device_registration.py
|
||||
# -----------------------------------
|
||||
# Tracks iOS devices that have registered with the server.
|
||||
# One row per physical device — upserted on every app foreground.
|
||||
|
||||
from app import db
|
||||
from app.utils.time_utils import now_eastern
|
||||
|
||||
|
||||
class DeviceRegistration(db.Model):
|
||||
__tablename__ = 'device_registrations'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
# Stable UUID generated on first launch and stored in iOS Keychain.
|
||||
# Unique across all devices; survives app restarts but not device wipes.
|
||||
device_id = db.Column(db.String(64), nullable=False, unique=True, index=True)
|
||||
user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False, index=True)
|
||||
device_name = db.Column(db.String(255), nullable=False, default='')
|
||||
app_version = db.Column(db.String(32), nullable=False, default='')
|
||||
ios_version = db.Column(db.String(32), nullable=False, default='')
|
||||
registered_at = db.Column(db.DateTime, nullable=False, default=now_eastern)
|
||||
last_seen_at = db.Column(db.DateTime, nullable=False, default=now_eastern)
|
||||
|
||||
user = db.relationship('User', backref=db.backref('devices', lazy='dynamic'))
|
||||
Reference in New Issue
Block a user