feat: Complete MVP implementation of Linux BenchTools
✨ Features: - Backend FastAPI complete (25 Python files) - 5 SQLAlchemy models (Device, HardwareSnapshot, Benchmark, Link, Document) - Pydantic schemas for validation - 4 API routers (benchmark, devices, links, docs) - Authentication with Bearer token - Automatic score calculation - File upload support - Frontend web interface (13 files) - 4 HTML pages (Dashboard, Devices, Device Detail, Settings) - 7 JavaScript modules - Monokai dark theme CSS - Responsive design - Complete CRUD operations - Client benchmark script (500+ lines Bash) - Hardware auto-detection - CPU, RAM, Disk, Network benchmarks - JSON payload generation - Robust error handling - Docker deployment - Optimized Dockerfile - docker-compose with 2 services - Persistent volumes - Environment variables - Documentation & Installation - Automated install.sh script - README, QUICKSTART, DEPLOYMENT guides - Complete API documentation - Project structure documentation 📊 Stats: - ~60 files created - ~5000 lines of code - Full MVP feature set implemented 🚀 Ready for production deployment! 🤖 Generated with Claude Code Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
35
backend/app/models/device.py
Normal file
35
backend/app/models/device.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""
|
||||
Linux BenchTools - Device Model
|
||||
"""
|
||||
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Text
|
||||
from sqlalchemy.orm import relationship
|
||||
from datetime import datetime
|
||||
from app.db.base import Base
|
||||
|
||||
|
||||
class Device(Base):
|
||||
"""
|
||||
Represents a machine (physical or virtual)
|
||||
"""
|
||||
__tablename__ = "devices"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
|
||||
hostname = Column(String(255), nullable=False, index=True)
|
||||
fqdn = Column(String(255), nullable=True)
|
||||
description = Column(Text, nullable=True)
|
||||
asset_tag = Column(String(100), nullable=True)
|
||||
location = Column(String(255), nullable=True)
|
||||
owner = Column(String(100), nullable=True)
|
||||
tags = Column(Text, nullable=True) # JSON or comma-separated
|
||||
created_at = Column(DateTime, nullable=False, default=datetime.utcnow)
|
||||
updated_at = Column(DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
# Relationships
|
||||
hardware_snapshots = relationship("HardwareSnapshot", back_populates="device", cascade="all, delete-orphan")
|
||||
benchmarks = relationship("Benchmark", back_populates="device", cascade="all, delete-orphan")
|
||||
manufacturer_links = relationship("ManufacturerLink", back_populates="device", cascade="all, delete-orphan")
|
||||
documents = relationship("Document", back_populates="device", cascade="all, delete-orphan")
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Device(id={self.id}, hostname='{self.hostname}')>"
|
||||
Reference in New Issue
Block a user