Skip to content

fix: strictly type sub and data parameters in alert-broadcaster.ts (#1976)#2138

Merged
dipexplorer merged 1 commit into
RatLoopz:mainfrom
nimkarprachi17:fix/alert-broadcaster-types-1976
Jun 20, 2026
Merged

fix: strictly type sub and data parameters in alert-broadcaster.ts (#1976)#2138
dipexplorer merged 1 commit into
RatLoopz:mainfrom
nimkarprachi17:fix/alert-broadcaster-types-1976

Conversation

@nimkarprachi17

Copy link
Copy Markdown
Contributor

🛑 STOP: Assignment & File Scope Check

  • I am assigned to this issue.
  • I verified that this PR ONLY touches the required files.

📋 PR Summary & Link

  • Closes [TYPES] Strictly type parameters in alert-broadcaster.ts #1976
  • Summary: Replaces any types for the sub and data parameters in apps/api/src/cron/alert-broadcaster.ts with strict interfaces. Created a new apps/api/src/types/notification.types.ts file containing NotificationSubscriber (matching the actual shape of rows from the notification_subscribers table — id, phone, language, channels, district, is_active) and NotificationAlertData (covering medicineName, batchNumber, district, expiryDate as used across counterfeit, recall, and expiry alert types). Note: this cron job broadcasts via SMS/WhatsApp rather than browser Web Push, so the types reflect the actual subscriber/payload shape used in the code rather than the web-push library's PushSubscription type.

📸 Proof of Work (Screenshots / Logs)

image

🏷️ PR Type

  • ♻️ type: refactor

✅ Checklist

  • My PR has a linked issue (Closes #1976)
  • I have pulled the latest main and resolved any conflicts

Files changed:

  • apps/api/src/cron/alert-broadcaster.ts — replaced sub: anysub: NotificationSubscriber, data: anydata: NotificationAlertData in sendNotificationToSubscriber, and updated getLocalizedMessage's data parameter to use NotificationAlertData
  • apps/api/src/types/notification.types.ts — new file with NotificationSubscriber and NotificationAlertData interfaces

@github-project-automation github-project-automation Bot moved this to 📥 Backlog in SahiDawa Workflow Jun 20, 2026
@github-actions github-actions Bot added gssoc:approved Approved for gssoc level:intermediate 35 pts type:refactor Code structure cleanup without behavior change labels Jun 20, 2026
@dipexplorer dipexplorer merged commit 9e70377 into RatLoopz:main Jun 20, 2026
12 of 14 checks passed
@github-project-automation github-project-automation Bot moved this from 📥 Backlog to 🎉 Merged in SahiDawa Workflow Jun 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @nimkarprachi17! Your Pull Request "fix: strictly type sub and data parameters in alert-broadcaster.ts (#1976)" has been successfully merged by @dipexplorer.

Thank you for your valuable contribution to SahiDawa! 🇮🇳
If this was for GSSoC 2026, your work is officially merged and valid. Keep up the great work and feel free to claim other open issues. 🚀

Follow us on LinkedIn: https://www.linkedin.com/company/ratloopz/ to get shoutout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved for gssoc level:beginner 20 pts level:intermediate 35 pts type:refactor Code structure cleanup without behavior change

Projects

Status: 🎉 Merged

Development

Successfully merging this pull request may close these issues.

[TYPES] Strictly type parameters in alert-broadcaster.ts

2 participants