From 57d04ddf1c5350b2df5b930945cc2e3881178513 Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 21 Jan 2025 13:34:20 +0300 Subject: [PATCH] published_at-fix2 --- resolvers/editor.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resolvers/editor.py b/resolvers/editor.py index a811527e..e3c1bbb6 100644 --- a/resolvers/editor.py +++ b/resolvers/editor.py @@ -110,9 +110,13 @@ async def create_shout(_, info, inp): if not is_draft: inp["published_at"] = current_time + # Устанавливаем обязательные поля inp["created_at"] = current_time inp["updated_at"] = current_time inp["created_by"] = author_dict.get("id") + inp["community"] = inp.get("community", 1) # Устанавливаем значение по умолчанию + inp["slug"] = inp.get("slug") or f"draft-{current_time}" # Генерируем slug если не указан + inp["lang"] = inp.get("lang", "ru") # Устанавливаем язык по умолчанию new_shout = Shout(**inp) session.add(new_shout)