diff --git a/notifications_routing/data_source/postgres/postgres_data_source.py b/notifications_routing/data_source/postgres/postgres_data_source.py index 6b8a0903b62a21de3bde6bf2541096d0ec612f21..ee74356f108a0ea0157468de8aed4df1ee90c623 100644 --- a/notifications_routing/data_source/postgres/postgres_data_source.py +++ b/notifications_routing/data_source/postgres/postgres_data_source.py @@ -108,13 +108,11 @@ class PostgresDataSource(DataSource): raise NotFoundDataSourceError(Channel, id=channel_id) unsubscribed_ids = [user.id for user in channel.unsubscribed] - # Comes as string from the queue, convert to UUID for proper DB comparison - targeted_ids = [uuid.UUID(user_id) for user_id in specified_target_users] return [ build_user(member) for member in channel.members - if (member.id in targeted_ids and member.id not in unsubscribed_ids) + if str(member.id) in specified_target_users and str(member.id) not in unsubscribed_ids ] def get_channel_unsubscribed_users(self, channel_id: str, **kwargs) -> List[str]: @@ -154,11 +152,8 @@ class PostgresDataSource(DataSource): if not channel: raise NotFoundDataSourceError(Channel, id=channel_id) - # Comes as string from the queue, convert to UUID for proper DB comparison - targeted_group_ids = [uuid.UUID(group_id) for group_id in specified_target_groups] - for group in channel.groups: - if group.id in targeted_group_ids: + if str(group.id) in specified_target_groups: groups.append({DataSource.GROUP_ID: group.id}) return groups