This commit is contained in:
2026-05-05 00:56:05 +03:30
parent 21b734f6a7
commit cfe60f6729
85 changed files with 1786 additions and 3840 deletions
+1
View File
@@ -0,0 +1 @@
@@ -0,0 +1 @@
@@ -0,0 +1,23 @@
from django.core.management.base import BaseCommand, CommandError
from device_hub.seeds import seed_sensor_7_in_1_demo_data
class Command(BaseCommand):
help = "Create or refresh demo sensor 7 in 1 data for summary and chart endpoints."
def handle(self, *args, **options):
try:
result = seed_sensor_7_in_1_demo_data()
except ValueError as exc:
raise CommandError(str(exc)) from exc
self.stdout.write(
self.style.SUCCESS(
"Sensor 7 in 1 demo data seeded: "
f"farm_uuid={result['farm'].farm_uuid}, "
f"sensor_catalog={result['sensor_catalog'].code}, "
f"physical_device_uuid={result['sensor'].physical_device_uuid}, "
f"logs={result['log_count']}"
)
)
@@ -0,0 +1,22 @@
from django.core.management.base import BaseCommand
from device_hub.catalog_seed import seed_sensor_catalog
class Command(BaseCommand):
help = "Seed sensor catalog data."
def handle(self, *args, **options):
results, created_count, updated_count = seed_sensor_catalog()
for sensor, created in results:
if created:
self.stdout.write(self.style.SUCCESS(f"Created sensor catalog item: {sensor.name}"))
else:
self.stdout.write(self.style.WARNING(f"Updated sensor catalog item: {sensor.name}"))
self.stdout.write(
self.style.SUCCESS(
f"Sensor catalog seeding complete. Created: {created_count}, Updated: {updated_count}"
)
)