Files
zooqueen fb4e3df0e3 rename: @hanzo/sign-* → @hanzo/esign-* (full eSign brand consistency)
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.
2026-06-21 19:56:09 -07:00

35 lines
1.4 KiB
TypeScript

// esign ZAP handlers — api-token router (fully ported, 3/3 procedures).
//
// Verbatim tRPC procedure bodies rewired to (ctx, input). Routes:
// apiToken.create / apiToken.getMany / apiToken.delete.
import { createApiToken } from '@hanzo/esign-lib/server-only/public-api/create-api-token';
import { deleteTokenById } from '@hanzo/esign-lib/server-only/public-api/delete-api-token-by-id';
import { getApiTokens } from '@hanzo/esign-lib/server-only/public-api/get-api-tokens';
import { ZCreateApiTokenRequestSchema } from '../../../server/api-token-router/create-api-token.types';
import { ZDeleteApiTokenRequestSchema } from '../../../server/api-token-router/delete-api-token.types';
import type { ZapContext } from '../context';
import type { ZapRouteMap } from '../dispatch';
export const apiTokenRoutes: ZapRouteMap = {
'apiToken.create': async (ctx: ZapContext, raw) => {
const { tokenName, teamId, expirationDate } = ZCreateApiTokenRequestSchema.parse(raw);
return await createApiToken({
userId: ctx.user.id,
teamId,
tokenName,
expiresIn: expirationDate,
});
},
'apiToken.getMany': async (ctx: ZapContext) => {
return await getApiTokens({ userId: ctx.user.id, teamId: ctx.teamId });
},
'apiToken.delete': async (ctx: ZapContext, raw) => {
const { id, teamId } = ZDeleteApiTokenRequestSchema.parse(raw);
await deleteTokenById({ id, teamId, userId: ctx.user.id });
return undefined;
},
};