mirror of
https://github.com/documenso/documenso.git
synced 2026-07-22 16:03:39 +10:00
138d663c25
Merge origin/main into feat/external-2fa-codes. Resolve formatting conflicts caused by biome rollout; preserve both feature streams: PR's external 2FA token + signing-session 2FA proof additions plus main's RateLimit/RecipientExpired/signingReminders/date-auto-insert. In complete-document-with-token.ts, drop the duplicate early field-fetching block introduced when main moved that logic later with date auto-insert support; keep the EXTERNAL_TWO_FACTOR_AUTH check using derivedRecipientActionAuth.
40 lines
987 B
TypeScript
40 lines
987 B
TypeScript
import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';
|
|
import { prisma } from '@documenso/prisma';
|
|
|
|
import { adminProcedure } from '../trpc';
|
|
import { ZGetEmailDomainRequestSchema, ZGetEmailDomainResponseSchema } from './get-email-domain.types';
|
|
|
|
export const getEmailDomainRoute = adminProcedure
|
|
.input(ZGetEmailDomainRequestSchema)
|
|
.output(ZGetEmailDomainResponseSchema)
|
|
.query(async ({ input }) => {
|
|
const { emailDomainId } = input;
|
|
|
|
const emailDomain = await prisma.emailDomain.findUnique({
|
|
where: {
|
|
id: emailDomainId,
|
|
},
|
|
omit: {
|
|
privateKey: true,
|
|
},
|
|
include: {
|
|
organisation: {
|
|
select: {
|
|
id: true,
|
|
name: true,
|
|
url: true,
|
|
},
|
|
},
|
|
emails: true,
|
|
},
|
|
});
|
|
|
|
if (!emailDomain) {
|
|
throw new AppError(AppErrorCode.NOT_FOUND, {
|
|
message: 'Email domain not found',
|
|
});
|
|
}
|
|
|
|
return emailDomain;
|
|
});
|