feat: add collaborative shopping lists with items and invitations
Some checks failed
CI / Verify (push) Has been cancelled
Some checks failed
CI / Verify (push) Has been cancelled
API: lists, items and invitations modules (list, create, get, update, set-primary, items create/list, invitation create/accept/list-pending), BetterAuth session helper, list membership, mailer and Prisma schema plus migrations. Web: lists overview, list detail (items) and list management (settings) views, item and invitation forms/hooks, sign-up and invitation accept pages. Shared: shopping list DTOs. Tooling: ignore the generated TanStack Router cache (apps/web/.tanstack).
This commit is contained in:
52
apps/api/src/lib/emails/invitation.ts
Normal file
52
apps/api/src/lib/emails/invitation.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import type { Email } from '@/lib/mailer'
|
||||
|
||||
type InvitationEmailInput = {
|
||||
inviterName: string
|
||||
listName: string
|
||||
acceptUrl: string
|
||||
}
|
||||
|
||||
/** Builds the "you have been invited to a list" email (in Spanish). */
|
||||
export function invitationEmail({
|
||||
inviterName,
|
||||
listName,
|
||||
acceptUrl,
|
||||
}: InvitationEmailInput): Omit<Email, 'to'> {
|
||||
const subject = `${inviterName} te invitó a la lista «${listName}»`
|
||||
|
||||
const text = [
|
||||
`${inviterName} te invitó a colaborar en la lista de compras «${listName}» en Superlist.`,
|
||||
'',
|
||||
'Abre este enlace para aceptar la invitación:',
|
||||
acceptUrl,
|
||||
'',
|
||||
'Si no tienes cuenta, podrás crear una en el mismo enlace.',
|
||||
].join('\n')
|
||||
|
||||
const html = `<!doctype html>
|
||||
<html lang="es">
|
||||
<body style="font-family: ui-sans-serif, system-ui, sans-serif; background:#f4f4f5; padding:32px;">
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="max-width:480px; margin:0 auto; background:#ffffff; border-radius:12px; padding:32px;">
|
||||
<tr><td>
|
||||
<h1 style="font-size:20px; margin:0 0 16px;">Te invitaron a una lista</h1>
|
||||
<p style="font-size:15px; line-height:1.5; color:#3f3f46; margin:0 0 8px;">
|
||||
<strong>${inviterName}</strong> te invitó a colaborar en la lista de compras
|
||||
<strong>«${listName}»</strong> en Superlist.
|
||||
</p>
|
||||
<p style="font-size:15px; line-height:1.5; color:#3f3f46; margin:0 0 24px;">
|
||||
Si todavía no tienes cuenta, podrás crear una en el mismo enlace.
|
||||
</p>
|
||||
<a href="${acceptUrl}" style="display:inline-block; background:#18181b; color:#ffffff; text-decoration:none; padding:12px 20px; border-radius:8px; font-size:15px;">
|
||||
Aceptar invitación
|
||||
</a>
|
||||
<p style="font-size:13px; line-height:1.5; color:#71717a; margin:24px 0 0;">
|
||||
Si el botón no funciona, copia y pega este enlace en tu navegador:<br />
|
||||
<a href="${acceptUrl}" style="color:#2563eb;">${acceptUrl}</a>
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>`
|
||||
|
||||
return { subject, html, text }
|
||||
}
|
||||
Reference in New Issue
Block a user