yksa-source-poller/tests/testapp/models.py
2026-08-18 22:05:57 +08:00

27 lines
862 B
Python

"""A minimal service, standing in for tdas and odms."""
from django.db import models
from yksa_poller.models import AbstractPollingSource, AbstractSourceRun
class Kind(models.TextChoices):
HTTP = "http", "HTTP"
PUSH = "push", "Push (fed from outside)"
class Satellite(models.Model):
norad_cat_id = models.CharField(max_length=16, blank=True)
internal_id = models.SlugField(max_length=64)
class Source(AbstractPollingSource):
SUBSCRIPTION_ID_FIELDS = {"norad": "norad_cat_id", "internal": "internal_id"}
kind = models.CharField(max_length=32, choices=Kind.choices)
subscription_id_kind = models.CharField(max_length=16, default="norad")
tracked_satellites = models.ManyToManyField(Satellite, blank=True)
class Run(AbstractSourceRun):
source = models.ForeignKey(Source, on_delete=models.CASCADE, related_name="runs")