From 9a91c1d5f8f3be65d572878fa7be057393c80cc5 Mon Sep 17 00:00:00 2001 From: helllllllder Date: Mon, 14 Oct 2024 15:29:48 -0300 Subject: [PATCH] feat: add flowstart_data --- chats/apps/api/v1/rooms/serializers.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/chats/apps/api/v1/rooms/serializers.py b/chats/apps/api/v1/rooms/serializers.py index f92d8e1d..49e06ab6 100644 --- a/chats/apps/api/v1/rooms/serializers.py +++ b/chats/apps/api/v1/rooms/serializers.py @@ -153,8 +153,16 @@ def get_queue(self, room: Room): def get_tags(self, room: Room): return [] - def get_flowstart_data(self, room: Room): - return {} + def get_flowstart_data(self, room: Room) -> bool: + try: + flowstart = room.flowstarts.get(is_deleted=False) + except (ObjectDoesNotExist, MultipleObjectsReturned): + return {} + return { + "name": flowstart.name, + "is_deleted": flowstart.is_deleted, + "created_on": flowstart.created_on, + } def get_contact(self, room: Room): return {