mirror of
https://github.com/hanzoai/sign.git
synced 2026-10-21 01:21:51 +00:00
The product is branded Hanzo eSign (esign.hanzo.ai, repo hanzoai/esign). Rename all workspace packages @hanzo/sign-* → @hanzo/esign-* (1052 files) and align docker/Dockerfile turbo --scope/--filter to the actual remix package name @hanzo/esign (was a pre-existing mismatch with -remix that broke the build). Protected deps (@hanzo/insights, @hanzo/logo) untouched.
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,
|
|
};
|
|
};
|