Files
zeekay b2083a6610 Say Hanzo eSign wherever the product names itself
Emails, the signing page's title, the sealed PDF's reason, the sign-in
refusal and the dialogs still said Hanzo Sign. The catalogs change with
the strings, message for message, so every translation keeps its id.
2026-10-20 13:12:22 -07:00

48 lines
1.0 KiB
TypeScript

import { prisma } from '@hanzo/esign-prisma';
import { SELFHOSTED_PLAN_LIMITS } from './constants';
import { ERROR_CODES } from './errors';
import type { TLimitsResponseSchema } from './schema';
export type GetServerLimitsOptions = {
userId: number;
teamId: number;
};
/**
* Hanzo eSign is fully AGPL — no paywalls, no plan tiers. Every team gets the
* self-hosted unlimited limits.
*/
export const getServerLimits = async ({
userId,
teamId,
}: GetServerLimitsOptions): Promise<TLimitsResponseSchema> => {
const organisation = await prisma.organisation.findFirst({
where: {
teams: {
some: {
id: teamId,
},
},
members: {
some: {
userId,
},
},
},
include: {
organisationClaim: true,
},
});
if (!organisation) {
throw new Error(ERROR_CODES.USER_FETCH_FAILED);
}
return {
quota: SELFHOSTED_PLAN_LIMITS,
remaining: SELFHOSTED_PLAN_LIMITS,
maximumEnvelopeItemCount: organisation.organisationClaim.envelopeItemCount,
};
};