redo migration. cleanup commented out code
This commit is contained in:
parent
bf0462cd74
commit
6a393acd26
2
.gitignore
vendored
2
.gitignore
vendored
@ -54,7 +54,7 @@ docs/_build/
|
|||||||
target/
|
target/
|
||||||
|
|
||||||
\.idea/dataSources/
|
\.idea/dataSources/
|
||||||
|
.idea
|
||||||
\.idea/dataSources\.xml
|
\.idea/dataSources\.xml
|
||||||
|
|
||||||
\.idea/dataSources\.local\.xml
|
\.idea/dataSources\.local\.xml
|
||||||
|
@ -16,26 +16,4 @@ class Connector(ABC):
|
|||||||
async def on_shopping_list_entry_deleted(self, space: Space, instance: ShoppingListEntry) -> None:
|
async def on_shopping_list_entry_deleted(self, space: Space, instance: ShoppingListEntry) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# @abstractmethod
|
# TODO: Add Recipes & possibly Meal Place listeners/hooks (And maybe more?)
|
||||||
# def on_recipe_created(self, instance: Recipe, **kwargs) -> None:
|
|
||||||
# pass
|
|
||||||
#
|
|
||||||
# @abstractmethod
|
|
||||||
# def on_recipe_updated(self, instance: Recipe, **kwargs) -> None:
|
|
||||||
# pass
|
|
||||||
#
|
|
||||||
# @abstractmethod
|
|
||||||
# def on_recipe_deleted(self, instance: Recipe, **kwargs) -> None:
|
|
||||||
# pass
|
|
||||||
#
|
|
||||||
# @abstractmethod
|
|
||||||
# def on_meal_plan_created(self, instance: MealPlan, **kwargs) -> None:
|
|
||||||
# pass
|
|
||||||
#
|
|
||||||
# @abstractmethod
|
|
||||||
# def on_meal_plan_updated(self, instance: MealPlan, **kwargs) -> None:
|
|
||||||
# pass
|
|
||||||
#
|
|
||||||
# @abstractmethod
|
|
||||||
# def on_meal_plan_deleted(self, instance: MealPlan, **kwargs) -> None:
|
|
||||||
# pass
|
|
||||||
|
@ -19,7 +19,6 @@ class ActionType(Enum):
|
|||||||
class ConnectorManager:
|
class ConnectorManager:
|
||||||
_connectors: Dict[str, List[Connector]]
|
_connectors: Dict[str, List[Connector]]
|
||||||
_listening_to_classes: UnionType = ShoppingListEntry | Recipe | MealPlan | Connector
|
_listening_to_classes: UnionType = ShoppingListEntry | Recipe | MealPlan | Connector
|
||||||
max_concurrent_tasks = 2
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._connectors = dict()
|
self._connectors = dict()
|
||||||
@ -79,20 +78,3 @@ class ConnectorManager:
|
|||||||
await asyncio.gather(*tasks, return_exceptions=False)
|
await asyncio.gather(*tasks, return_exceptions=False)
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
print("received an exception from one of the tasks: ", e)
|
print("received an exception from one of the tasks: ", e)
|
||||||
# if isinstance(instance, Recipe):
|
|
||||||
# if "created" in kwargs and kwargs["created"]:
|
|
||||||
# for connector in self._connectors:
|
|
||||||
# connector.on_recipe_created(instance, **kwargs)
|
|
||||||
# return
|
|
||||||
# for connector in self._connectors:
|
|
||||||
# connector.on_recipe_updated(instance, **kwargs)
|
|
||||||
# return
|
|
||||||
#
|
|
||||||
# if isinstance(instance, MealPlan):
|
|
||||||
# if "created" in kwargs and kwargs["created"]:
|
|
||||||
# for connector in self._connectors:
|
|
||||||
# connector.on_meal_plan_created(instance, **kwargs)
|
|
||||||
# return
|
|
||||||
# for connector in self._connectors:
|
|
||||||
# connector.on_meal_plan_updated(instance, **kwargs)
|
|
||||||
# return
|
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
# Generated by Django 4.2.7 on 2024-01-11 19:53
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('cookbook', '0206_alter_storage_path_homeassistantconfig'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='homeassistantconfig',
|
|
||||||
name='on_shopping_list_entry_created_enabled',
|
|
||||||
field=models.BooleanField(default=False, help_text='Enable syncing ShoppingListEntry to Homeassistant Todo List'),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='homeassistantconfig',
|
|
||||||
name='on_shopping_list_entry_deleted_enabled',
|
|
||||||
field=models.BooleanField(default=False, help_text='Enable syncing ShoppingListEntry deletion to Homeassistant Todo List'),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='homeassistantconfig',
|
|
||||||
name='on_shopping_list_entry_updated_enabled',
|
|
||||||
field=models.BooleanField(default=False, help_text='PLACEHOLDER'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='homeassistantconfig',
|
|
||||||
name='url',
|
|
||||||
field=models.URLField(blank=True),
|
|
||||||
),
|
|
||||||
]
|
|
@ -1,4 +1,4 @@
|
|||||||
# Generated by Django 4.2.7 on 2024-01-10 21:28
|
# Generated by Django 4.2.7 on 2024-01-11 21:34
|
||||||
|
|
||||||
import cookbook.models
|
import cookbook.models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@ -8,9 +8,10 @@ import django.db.models.deletion
|
|||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
('cookbook', '0205_alter_food_fdc_id_alter_propertytype_fdc_id'),
|
('cookbook', '0207_space_logo_color_128_space_logo_color_144_and_more'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
@ -19,9 +20,12 @@ class Migration(migrations.Migration):
|
|||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
('name', models.CharField(max_length=128, validators=[django.core.validators.MinLengthValidator(1)])),
|
('name', models.CharField(max_length=128, validators=[django.core.validators.MinLengthValidator(1)])),
|
||||||
('url', models.URLField(blank=True, help_text='Something like http://homeassistant:8123/api')),
|
('url', models.URLField(blank=True)),
|
||||||
('token', models.CharField(blank=True, max_length=512)),
|
('token', models.CharField(blank=True, max_length=512)),
|
||||||
('todo_entity', models.CharField(default='todo.shopping_list', max_length=128)),
|
('todo_entity', models.CharField(default='todo.shopping_list', max_length=128)),
|
||||||
|
('on_shopping_list_entry_created_enabled', models.BooleanField(default=False, help_text='Enable syncing ShoppingListEntry to Homeassistant Todo List')),
|
||||||
|
('on_shopping_list_entry_updated_enabled', models.BooleanField(default=False, help_text='PLACEHOLDER')),
|
||||||
|
('on_shopping_list_entry_deleted_enabled', models.BooleanField(default=False, help_text='Enable syncing ShoppingListEntry deletion to Homeassistant Todo List')),
|
||||||
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
|
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
|
||||||
('space', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cookbook.space')),
|
('space', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cookbook.space')),
|
||||||
],
|
],
|
Loading…
Reference in New Issue
Block a user