Skip to content

Commit bb055e9

Browse files
Clément VALENTINclaude
andcommitted
fix(api): fix type annotations in SlackService
Add proper type hints for dict and list types to pass mypy checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a2d039b commit bb055e9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

apps/api/src/services/slack.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import httpx
2+
from typing import Any
23
from ..config import settings
34
from ..models import OfferContribution, User
45
import logging
@@ -14,7 +15,9 @@ def __init__(self) -> None:
1415
self.webhook_url = settings.SLACK_WEBHOOK_URL
1516
self.enabled = settings.SLACK_NOTIFICATIONS_ENABLED
1617

17-
async def send_notification(self, message: str, blocks: list[dict] | None = None) -> bool:
18+
async def send_notification(
19+
self, message: str, blocks: list[dict[str, Any]] | None = None
20+
) -> bool:
1821
"""Send a notification to Slack
1922
2023
Args:
@@ -33,7 +36,7 @@ async def send_notification(self, message: str, blocks: list[dict] | None = None
3336
return False
3437

3538
try:
36-
payload = {"text": message}
39+
payload: dict[str, Any] = {"text": message}
3740
if blocks:
3841
payload["blocks"] = blocks
3942

@@ -127,7 +130,7 @@ async def send_contribution_notification(self, contribution: OfferContribution,
127130
power_display = f"{contribution.power_kva} kVA" if contribution.power_kva else "Non spécifié"
128131

129132
# Build Slack blocks for rich formatting
130-
blocks = [
133+
blocks: list[dict[str, Any]] = [
131134
{
132135
"type": "header",
133136
"text": {

0 commit comments

Comments
 (0)