Conversation
Email alerts:
- POST /subscriptions creates a per-DAO subscription (email, KT1 address, network) and sends a confirmation email; always answers 200 so it cannot be used to probe addresses
- GET /subscriptions/confirm/:token and /unsubscribe/:token redirect back to the app with ?alerts=confirmed|unsubscribed|invalid
- Subscription model with unique email+DAO+network index, nodemailer mailer service that is a no-op until SMTP_HOST is set
- Confirmation subject carries a timestamp so mail clients do not thread repeated confirmations; the confirm token is kept stable across repeat requests
Polls:
- /poll/add accepts an optional fundingRequest {recipient, amount}, validated as a Tezos address and a positive XTZ amount
- POST /polls/:id/link-proposal (signed) records the on-chain proposal a poll was promoted to; allowed for the poll author or the community admin
Tests for both routes; config.env.example documents the new SMTP and URL variables.
Claude-Session: https://claude.ai/code/session_01UG9AFKKU31ba2d9QNLV44R
❌ Deploy Preview for homebase-backend failed. Why did it fail? →
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two additions to the lite backend, both aimed at shortening the Ecosystem DAO grant cycle (poll on Homebase, then an on-chain transfer proposal, then keyholder votes).
DAO email alerts
POST /subscriptionswith{ email, daoAddress, network, daoName? }creates a per-DAO subscription and sends a confirmation email (double opt-in). Always answers200 { ok: true }for well-formed input so the endpoint cannot be used to check whether an address is subscribed. In-memory throttle of 5 requests per email per hour.GET /subscriptions/confirm/:tokenandGET /subscriptions/unsubscribe/:tokenredirect back to the app with?alerts=confirmed|unsubscribed|invalid.Subscriptionmodel (collectionSubscriptions), unique on email + DAO + network.services/mailer.service.jswraps nodemailer and is a no-op untilSMTP_HOSTis set, so nothing changes for environments without mail configured.The emails themselves (proposal created, voting closes soon, passed, executable, executed, dropped, expired) are sent by a separate watcher that reads the indexer and this collection.
Poll funding requests
/poll/addaccepts an optionalfundingRequest: { recipient, amount }, validated as a Tezos address and a positive XTZ amount with up to 6 decimals.POST /polls/:id/link-proposal(signed like every other write) records the on-chain proposal a poll was promoted to. Allowed for the poll author or the community admin.Config
New optional env vars, documented in
config.env.example:SMTP_HOST,SMTP_PORT,SMTP_USER,SMTP_PASS,MAIL_FROM,APP_URL,PUBLIC_API_URL. They need to be set on the Netlify site before this is useful in production.Tests
npx jest routes/subscriptions.test.js routes/polls.test.js: 35 passing. Verified end to end against the real SMTP sender: subscribe, confirmation email, confirm link, unsubscribe link, and a "proposal created" email after an on-chain proposal.Notes
feat/testsbecause that is what the Netlify site deploys from. PR chore: resolve form-data, ws CVEs via resolutions/overrides #38 (dependency CVE fix) is still not on it; worth merging in the same deploy.https://claude.ai/code/session_01UG9AFKKU31ba2d9QNLV44R