New Plugins: - USB plugin: Device checkout/checkin with employee lookup, checkout history - Notifications plugin: Announcements with types, scheduling, shopfloor display - Network plugin: Network device management with subnets and VLANs - Equipment and Computers plugins: Asset type separation Frontend: - EmployeeSearch component: Reusable employee lookup with autocomplete - USB views: List, detail, checkout/checkin modals - Notifications views: List, form with recognition mode - Network views: Device list, detail, form - Calendar view with FullCalendar integration - Shopfloor and TV dashboard views - Reports index page - Map editor for asset positioning - Light/dark mode fixes for map tooltips Backend: - Employee search API with external lookup service - Collector API for PowerShell data collection - Reports API endpoints - Slides API for TV dashboard - Fixed AppVersion model (removed BaseModel inheritance) - Added checkout_name column to usbcheckouts table Styling: - Unified detail page styles - Improved pagination (page numbers instead of prev/next) - Dark/light mode theme improvements Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
"""USB Checkout model."""
|
|
|
|
from shopdb.extensions import db
|
|
from datetime import datetime
|
|
|
|
|
|
class USBCheckout(db.Model):
|
|
"""
|
|
USB device checkout tracking.
|
|
|
|
References machines table (USB devices have machinetypeid=44).
|
|
"""
|
|
__tablename__ = 'usbcheckouts'
|
|
|
|
checkoutid = db.Column(db.Integer, primary_key=True)
|
|
machineid = db.Column(db.Integer, db.ForeignKey('machines.machineid'), nullable=False, index=True)
|
|
sso = db.Column(db.String(20), nullable=False, index=True)
|
|
checkout_name = db.Column(db.String(100))
|
|
checkout_reason = db.Column(db.Text)
|
|
checkout_time = db.Column(db.DateTime, default=datetime.utcnow, index=True)
|
|
checkin_time = db.Column(db.DateTime, index=True)
|
|
was_wiped = db.Column(db.Boolean, default=False)
|
|
checkin_notes = db.Column(db.Text)
|
|
|
|
def to_dict(self):
|
|
"""Convert to dictionary."""
|
|
return {
|
|
'checkoutid': self.checkoutid,
|
|
'machineid': self.machineid,
|
|
'sso': self.sso,
|
|
'checkout_name': self.checkout_name,
|
|
'checkout_reason': self.checkout_reason,
|
|
'checkout_time': self.checkout_time.isoformat() if self.checkout_time else None,
|
|
'checkin_time': self.checkin_time.isoformat() if self.checkin_time else None,
|
|
'was_wiped': self.was_wiped,
|
|
'checkin_notes': self.checkin_notes,
|
|
'is_checked_out': self.checkin_time is None
|
|
}
|