From 20b4f101a29977cb5c8093651ff8d80bc158e377 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Mon, 6 Mar 2023 21:11:17 +0000 Subject: [PATCH] Add aggregator service choices --- core/models.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/models.py b/core/models.py index e7911eb..fc6e19a 100644 --- a/core/models.py +++ b/core/models.py @@ -1,7 +1,5 @@ import uuid -from datetime import timedelta -from django.conf import settings from django.contrib.auth.models import AbstractUser from django.db import models @@ -10,6 +8,8 @@ from core.util import logs log = logs.get_logger(__name__) +SERVICE_CHOICES = (("nordigen", "Nordigen"),) + class User(AbstractUser): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) @@ -22,9 +22,16 @@ class User(AbstractUser): class NotificationSettings(models.Model): - user = models.OneToOneField(User, on_delete=models.CASCADE) + user = models.ForeignKey(User, on_delete=models.CASCADE) ntfy_topic = models.CharField(max_length=255, null=True, blank=True) ntfy_url = models.CharField(max_length=255, null=True, blank=True) def __str__(self): return f"Notification settings for {self.user}" + + +class Aggregator(models.Model): + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + user = models.ForeignKey(User, on_delete=models.CASCADE) + name = models.CharField(max_length=255) + service = models.CharField(max_length=255, choices=SERVICE_CHOICES)