Skip to content

Implement contribution reminder scheduler using BullMQ #4

Description

@Mona-i

Problem

The package.json includes bullmq and ioredis but they are not wired up anywhere in the codebase. One of the most important features for cooperative groups is automated reminders when a member's monthly contribution is due — currently there is no scheduler at all.

Task

Implement a contribution reminder system:

  1. Create src/modules/notifications/reminder.queue.ts
    Set up a BullMQ queue called contribution-reminders.
  2. Create src/modules/notifications/reminder.processor.ts

A BullMQ worker that:

Receives job payload: { groupId, memberAddress, period, dueDate }
Calls NotificationsService.create(memberAddress, 'contribution_due', ...)
(Optional) Sends email if member has email on file (stub it with a TODO comment)

  1. Schedule reminder jobs
    In a @Cron(CronExpression.EVERY_DAY_AT_9AM) job:
  • For each active group, check its contribution_period_days from governance rules
  • For each member not yet contributed in current period
  • Enqueue a reminder job 3 days before contribution is due
  1. Redis config

Add Redis connection to AppModule using BullModule.forRoot().

Acceptance Criteria

  • BullMQ queue and processor implemented
  • Daily cron job enqueues reminders for due-soon members
  • Notification record created in DB when job runs
  • Redis connection configurable via REDIS_URL env var
  • Queue can be monitored (add bull-board or log queue stats)
  • Unit test: mock queue, verify jobs enqueued correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions