from django.db import models from Boxes.models import MysteryBox from Accounts.models import Profile class SalesReport(models.Model): date = models.DateField() total_orders = models.IntegerField() total_revenue = models.DecimalField(max_digits=12, decimal_places=2) top_box = models.ForeignKey(MysteryBox, on_delete=models.SET_NULL, null=True, blank=True) def __str__(self): return f"Sales Report - {self.date}" class UserStats(models.Model): user = models.OneToOneField(Profile, on_delete=models.CASCADE) total_spent = models.DecimalField(max_digits=12, decimal_places=2, default=0.00) boxes_purchased = models.IntegerField(default=0) last_active = models.DateTimeField(auto_now=True) def __str__(self): return f"Stats for {self.user.user.username}"