Skip to content

Commit f49a2b0

Browse files
committed
fix: Provide type for whitelist and whitelist external
1 parent 397e80a commit f49a2b0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

backend/core/dtos/chat/rules/whitelist.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
from pydantic import BaseModel
66

7-
from core.models import TelegramChatWhitelistExternalSource, TelegramChatWhitelist
7+
from core.dtos.chat.rules import EligibilityCheckType
8+
from core.models.rule import TelegramChatWhitelistExternalSource, TelegramChatWhitelist
89

910

1011
class WhitelistRuleItemsDifferenceDTO(BaseModel):
@@ -30,6 +31,7 @@ class WhitelistRuleCPO(BaseModel):
3031

3132
class BaseWhitelistRuleDTO(BaseModel):
3233
id: int
34+
type: EligibilityCheckType
3335
chat_id: int
3436
name: str
3537
description: str | None
@@ -44,6 +46,7 @@ class WhitelistRuleDTO(BaseWhitelistRuleDTO):
4446
def from_orm(cls, obj: TelegramChatWhitelist) -> Self:
4547
return cls(
4648
id=obj.id,
49+
type=EligibilityCheckType.WHITELIST,
4750
chat_id=obj.chat_id,
4851
name=obj.name,
4952
description=obj.description,
@@ -61,6 +64,7 @@ class WhitelistRuleExternalDTO(BaseWhitelistRuleDTO):
6164
def from_orm(cls, obj: TelegramChatWhitelistExternalSource) -> Self:
6265
return cls(
6366
id=obj.id,
67+
type=EligibilityCheckType.EXTERNAL_SOURCE,
6468
chat_id=obj.chat_id,
6569
url=obj.url,
6670
name=obj.name,

0 commit comments

Comments
 (0)