mirror of
https://github.com/hanzoai/sign.git
synced 2026-10-21 01:21:51 +00:00
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.
48 lines
1.0 KiB
TypeScript
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,
|
|
};
|
|
};
|