feat(server): album's email notification (#9439)

* feat(server): album's email notification

* same size button

* skeleton for album invite and album update event

* album invite content

* album update

* fix(server): smtp certificate validation (#9506)

* album update content

* send mail

* album invite with thumbnail

* pr feedback

* styling

* Send email to update album event

* better naming

* add tests

* Update album-invite.email.tsx

Co-authored-by: bo0tzz <git@bo0tzz.me>

* Update album-update.email.tsx

Co-authored-by: bo0tzz <git@bo0tzz.me>

* fix: unit tests

* typo

* Update server/src/services/notification.service.ts

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>

* PR feedback

* Update server/src/emails/album-update.email.tsx

Co-authored-by: Zack Pollard <zackpollard@ymail.com>

---------

Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com>
Co-authored-by: bo0tzz <git@bo0tzz.me>
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
Co-authored-by: Zack Pollard <zackpollard@ymail.com>
This commit is contained in:
Alex 2024-05-28 09:16:46 +07:00 committed by GitHub
parent 832084687d
commit 1f9158c545
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 580 additions and 8 deletions

View file

@ -1,5 +1,11 @@
export const INotificationRepository = 'INotificationRepository';
export type EmailImageAttachment = {
filename: string;
path: string;
cid: string;
};
export type SendEmailOptions = {
from: string;
to: string;
@ -7,6 +13,7 @@ export type SendEmailOptions = {
subject: string;
html: string;
text: string;
imageAttachments?: EmailImageAttachment[];
smtp: SmtpOptions;
};
@ -19,18 +26,53 @@ export type SmtpOptions = {
};
export enum EmailTemplate {
// AUTH
WELCOME = 'welcome',
RESET_PASSWORD = 'reset-password',
// ALBUM
ALBUM_INVITE = 'album-invite',
ALBUM_UPDATE = 'album-update',
}
export interface WelcomeEmailProps {
interface BaseEmailProps {
baseUrl: string;
}
export interface WelcomeEmailProps extends BaseEmailProps {
displayName: string;
username: string;
password?: string;
}
export type EmailRenderRequest = { template: EmailTemplate.WELCOME; data: WelcomeEmailProps };
export interface AlbumInviteEmailProps extends BaseEmailProps {
albumName: string;
albumId: string;
senderName: string;
recipientName: string;
cid?: string;
}
export interface AlbumUpdateEmailProps extends BaseEmailProps {
albumName: string;
albumId: string;
recipientName: string;
cid?: string;
}
export type EmailRenderRequest =
| {
template: EmailTemplate.WELCOME;
data: WelcomeEmailProps;
}
| {
template: EmailTemplate.ALBUM_INVITE;
data: AlbumInviteEmailProps;
}
| {
template: EmailTemplate.ALBUM_UPDATE;
data: AlbumUpdateEmailProps;
};
export type SendEmailResponse = {
messageId: string;