Jul 30 - Allow customer to flag follow-up a inspection
This commit is contained in:
@@ -81,6 +81,14 @@ class Inspection(db.Model):
|
||||
)
|
||||
follow_up_required = db.Column(db.Boolean, nullable=False, default=False)
|
||||
follow_up_note = db.Column(db.Text, nullable=True)
|
||||
# Who asked for the follow-up (phase46). NULL for legacy rows flagged before
|
||||
# the column existed. Matters because customers can now raise the request
|
||||
# themselves — staff need to see at a glance that the client is waiting on
|
||||
# this one, not another internal reviewer.
|
||||
follow_up_requested_by = db.Column(
|
||||
db.Integer, db.ForeignKey('users.id', ondelete='SET NULL'), nullable=True
|
||||
)
|
||||
follow_up_requested_at = db.Column(db.DateTime, nullable=True)
|
||||
|
||||
results = db.relationship('InspectionResult', backref='inspection', lazy='dynamic', cascade='all, delete-orphan')
|
||||
issues = db.relationship('Issue', backref='inspection', lazy='dynamic', cascade='all, delete-orphan')
|
||||
@@ -88,6 +96,10 @@ class Inspection(db.Model):
|
||||
# None for ad-hoc/manual inspections or if the schedule was later deleted.
|
||||
scheduled_inspection = db.relationship('ScheduledInspection',
|
||||
foreign_keys=[scheduled_inspection_id])
|
||||
# The user who requested the follow-up (phase46) — a customer or a manager.
|
||||
# Explicit foreign_keys: `inspector_id` also points at users.
|
||||
follow_up_requester = db.relationship('User',
|
||||
foreign_keys=[follow_up_requested_by])
|
||||
follow_ups = db.relationship('Inspection', backref=db.backref('parent', remote_side='Inspection.id'),
|
||||
lazy='dynamic', foreign_keys='Inspection.parent_inspection_id')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user