mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
feat: add email domains (#1895)
Implemented Email Domains which allows Platform/Enterprise customers to send emails to recipients using their custom emails.
This commit is contained in:
40
packages/trpc/server/enterprise-router/get-subscription.ts
Normal file
40
packages/trpc/server/enterprise-router/get-subscription.ts
Normal file
@ -0,0 +1,40 @@
|
||||
import { getInternalClaimPlans } from '@documenso/ee/server-only/stripe/get-internal-claim-plans';
|
||||
import { getSubscription } from '@documenso/ee/server-only/stripe/get-subscription';
|
||||
import { IS_BILLING_ENABLED } from '@documenso/lib/constants/app';
|
||||
import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';
|
||||
|
||||
import { authenticatedProcedure } from '../trpc';
|
||||
import { ZGetSubscriptionRequestSchema } from './get-subscription.types';
|
||||
|
||||
export const getSubscriptionRoute = authenticatedProcedure
|
||||
.input(ZGetSubscriptionRequestSchema)
|
||||
.query(async ({ ctx, input }) => {
|
||||
const { organisationId } = input;
|
||||
|
||||
ctx.logger.info({
|
||||
input: {
|
||||
organisationId,
|
||||
},
|
||||
});
|
||||
|
||||
const userId = ctx.user.id;
|
||||
|
||||
if (!IS_BILLING_ENABLED()) {
|
||||
throw new AppError(AppErrorCode.INVALID_REQUEST, {
|
||||
message: 'Billing is not enabled',
|
||||
});
|
||||
}
|
||||
|
||||
const [subscription, plans] = await Promise.all([
|
||||
getSubscription({
|
||||
organisationId,
|
||||
userId,
|
||||
}),
|
||||
getInternalClaimPlans(),
|
||||
]);
|
||||
|
||||
return {
|
||||
subscription,
|
||||
plans,
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user