Skip to content

Support dual teacher/student Telegram roles and add notification & reminder plumbing#303

Merged
Despire1 merged 2 commits intomainfrom
dl01dn-codex/implement-telegram-notifications-for-users
Jan 9, 2026
Merged

Support dual teacher/student Telegram roles and add notification & reminder plumbing#303
Despire1 merged 2 commits intomainfrom
dl01dn-codex/implement-telegram-notifications-for-users

Conversation

@Despire1
Copy link
Copy Markdown
Owner

@Despire1 Despire1 commented Jan 9, 2026

Motivation

  • Allow a Telegram user to act as both Teacher and Student simultaneously without role conflicts or overwriting existing teacher data.
  • Add server-side notification infrastructure to send lesson reminders, unpaid digests and student payment reminders.
  • Expose manual payment reminders from the UI and ensure reminders are deduplicated/auditable.

Description

  • Bot: updated src/backend/telegramBot.ts to always refresh profile data on /start via ensureTelegramUser, present role selection, persist explicit role selection via upsertTelegramUser, and permit opening the teacher mini-app when a Teacher profile exists via canOpenTeacherApp without removing student data.
  • Database & migrations: extended prisma/schema.prisma with NotificationLog, added Student.isActivated/activatedAt, added Lesson.paidAt/completedAt, added User.role, and included a corresponding migration SQL (prisma/migrations/20260109094654_add_notifications/migration.sql).
  • Server/notifications: added src/backend/notificationService.ts with functions to send teacher/student reminders and unpaid digests, integrated runNotificationTick() into src/backend/server.ts, and added a new API route POST /api/lessons/:lessonId/remind-payment that invokes sendStudentPaymentReminder.
  • UI/client: added api.remindLessonPayment to src/shared/api/client.ts, wired remindLessonPayment through AppPage, AppRoutes, and StudentsSection, and added a remind button, spinner and handlers in StudentDebtPopoverContent and StudentHero with rate-limit/disable reasons surfaced to the user.

Testing

  • No automated unit/integration tests were executed for these changes.

Codex Task

@Despire1 Despire1 merged commit eadd3de into main Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant