Skip to content

Feat: weekly email digest of coding activity summary#1157

Open
diksha78dev wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
diksha78dev:fix/issue-1028
Open

Feat: weekly email digest of coding activity summary#1157
diksha78dev wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
diksha78dev:fix/issue-1028

Conversation

@diksha78dev
Copy link
Copy Markdown

@diksha78dev diksha78dev commented May 26, 2026

Summary

Adds a new opt-in feature for users to receive a weekly email digest summarizing their coding habits. The feature introduces a new UI toggle in the settings and a secure Vercel Cron endpoint to handle dispatching emails via the Resend API.

Closes #1028

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

Database : Added a migration to include weekly_digest_opt_in (boolean) and email (text) to the users Supabase table.
Auth: Updated NextAuth signIn callback to capture and save the user's email to the database on login.
Settings UI/API : Added a new "Weekly Email Digest" toggle in the Settings page and updated the GET / PATCH routes to support the new field.
Cron API: Created a secured /api/cron/weekly-digest route that queries opted-in users and sends HTML digests using a native fetch request to the Resend API (keeping dependencies small).
Vercel Config: Configured vercel.json with a cron schedule (0 9 * * 1 - every Monday at 9 AM UTC).
Testing Fix: Fixed a pre-existing duplicate test title in landing.spec.js that caused E2E test failures.

How to Test

Steps for the reviewer to verify this works:

  1. Setup your local Supabase database and apply the new migration (or run npx supabase db reset).
  2. Set RESEND_API_KEY (and optionally CRON_SECRET) in your local .env file.
  3. Start the dev server (npm run dev), go to the Settings page, and toggle on the "Weekly Email Digest".
  4. To test the cron job locally, execute the following command in your terminal (if using a cron secret, add -H "Authorization: Bearer YOUR_SECRET"): curl -X GET http://localhost:3000/api/cron/weekly-digest
  5. Check your email inbox to verify the digest template was received successfully.

Screenshots (if UI change)

Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Self-reviewed the diff
  • Added/updated tests if applicable

@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

@diksha78dev is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts) labels May 26, 2026
@github-actions
Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

Good feature overall. One concern: adding email to the Supabase upsert in auth.ts will break sign-in for all users if the migration (20260526000000_add_weekly_digest_opt_in.sql) has not been run yet — PostgREST returns a 42703 error on unknown columns, which is not caught here.

Please add a try/catch around the email field or add the column to the migration before this can be safely merged. The rest of the feature (tiered settings with the 42703 fallback) is correctly handled.

@diksha78dev
Copy link
Copy Markdown
Author

I'll make the required changes and resolve the conflicts..
Thanks for review..

# Conflicts:
#	e2e/landing.spec.js
#	src/lib/auth.ts
@diksha78dev
Copy link
Copy Markdown
Author

@Priyanshu-byte-coder i have resolved the merge conflicts .
Kindly review my PR.

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

Labels

gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: weekly email digest of coding activity summary

2 participants