feat: migrate templates and documents to envelope model

This commit is contained in:
David Nguyen
2025-09-11 18:23:38 +10:00
parent eec2307634
commit bf89bc781b
234 changed files with 8677 additions and 6054 deletions

View File

@ -1,4 +1,4 @@
import { DocumentSource, SubscriptionStatus } from '@prisma/client';
import { DocumentSource, EnvelopeType, SubscriptionStatus } from '@prisma/client';
import { DateTime } from 'luxon';
import { IS_BILLING_ENABLED } from '@documenso/lib/constants/app';
@ -84,8 +84,9 @@ export const getServerLimits = async ({
}
const [documents, directTemplates] = await Promise.all([
prisma.document.count({
prisma.envelope.count({
where: {
type: EnvelopeType.DOCUMENT,
team: {
organisationId: organisation.id,
},
@ -97,8 +98,9 @@ export const getServerLimits = async ({
},
},
}),
prisma.template.count({
prisma.envelope.count({
where: {
type: EnvelopeType.TEMPLATE,
team: {
organisationId: organisation.id,
},