Files
speckle-server/packages/server/modules/emails/domain/operations.ts
T
Kristaps Fabians Geikins 4b06f42db7 chore(server): run TS files directly (no compilation) (#5134)
* sort of works

* type fixes

* added option to run old way too
2025-07-23 11:20:40 +02:00

86 lines
1.7 KiB
TypeScript

import type { UserRecord } from '@/modules/core/helpers/types'
import type { EmailVerification } from '@/modules/emails/domain/types'
import type { EmailVerificationRecord } from '@/modules/emails/repositories'
/**
* Repositories
*/
export type GetPendingToken = (params: {
token?: string
email?: string
}) => Promise<EmailVerificationRecord | undefined>
export type DeleteVerifications = (email: string) => Promise<void>
export type DeleteOldAndInsertNewVerification = (email: string) => Promise<string>
/**
* Services
*/
export type RequestNewEmailVerification = (emailId: string) => Promise<void>
export type RequestEmailVerification = (userId: string) => Promise<void>
export type SendEmailParams = {
from?: string
to: string | string[]
subject: string
text: string
html: string
}
export type SendEmail = (args: SendEmailParams) => Promise<boolean>
export type EmailTemplateServerInfo = {
name: string
canonicalUrl: string
company: string
adminContact: string
}
export type EmailCta = {
title: string
url: string
}
export type EmailBody = {
text: string
mjml: string
}
export type EmailInput = {
from?: string
to: string
subject: string
text: string
html: string
}
export type EmailContent = {
text: string
html: string
}
export type EmailTemplateParams = {
mjml: { bodyStart: string; bodyEnd?: string }
text: { bodyStart: string; bodyEnd?: string }
cta?: {
url: string
title: string
altTitle?: string
}
}
export type RenderEmail = (
templateParams: EmailTemplateParams,
serverInfo: EmailTemplateServerInfo,
user: UserRecord | null
) => Promise<EmailContent>
export type GetPendingVerificationByEmail = ({
email
}: {
email: string
}) => Promise<EmailVerification | undefined>