mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
fix: update template limits
This commit is contained in:
@ -11,6 +11,7 @@ import { deleteTemplate } from '@documenso/lib/server-only/template/delete-templ
|
||||
import { deleteTemplateDirectLink } from '@documenso/lib/server-only/template/delete-template-direct-link';
|
||||
import { duplicateTemplate } from '@documenso/lib/server-only/template/duplicate-template';
|
||||
import { findTemplates } from '@documenso/lib/server-only/template/find-templates';
|
||||
import { getTemplateById } from '@documenso/lib/server-only/template/get-template-by-id';
|
||||
import { getTemplateWithDetailsById } from '@documenso/lib/server-only/template/get-template-with-details-by-id';
|
||||
import { moveTemplateToTeam } from '@documenso/lib/server-only/template/move-template-to-team';
|
||||
import { toggleTemplateDirectLink } from '@documenso/lib/server-only/template/toggle-template-direct-link';
|
||||
@ -99,7 +100,7 @@ export const templateRouter = router({
|
||||
try {
|
||||
const { templateId, teamId } = input;
|
||||
|
||||
const limits = await getServerLimits({ email: ctx.user.email });
|
||||
const limits = await getServerLimits({ email: ctx.user.email, teamId });
|
||||
|
||||
if (limits.remaining.documents === 0) {
|
||||
throw new Error('You have reached your document limit.');
|
||||
@ -247,7 +248,9 @@ export const templateRouter = router({
|
||||
|
||||
const userId = ctx.user.id;
|
||||
|
||||
const limits = await getServerLimits({ email: ctx.user.email });
|
||||
const template = await getTemplateById({ id: templateId, userId: ctx.user.id });
|
||||
|
||||
const limits = await getServerLimits({ email: ctx.user.email, teamId: template.teamId });
|
||||
|
||||
if (limits.remaining.directTemplates === 0) {
|
||||
throw new AppError(
|
||||
|
||||
Reference in New Issue
Block a user