Skip to content

The Open Source DocuSign Alternative.

fix: api keys not showing (#1839)

David Nguyenb8e08e88ace7
diff --git a/apps/remix/app/components/dialogs/organisation-create-dialog.tsx b/apps/remix/app/components/dialogs/organisation-create-dialog.tsx
index 1e564ccaf..f57789a74 100644
--- a/apps/remix/app/components/dialogs/organisation-create-dialog.tsx
+++ b/apps/remix/app/components/dialogs/organisation-create-dialog.tsx
@@ -83,7 +83,9 @@ export const OrganisationCreateDialog = ({ trigger, ...props }: OrganisationCrea
const { mutateAsync: createOrganisation } = trpc.organisation.create.useMutation();
- const { data: plansData } = trpc.billing.plans.get.useQuery();
+ const { data: plansData } = trpc.billing.plans.get.useQuery(undefined, {
+ enabled: IS_BILLING_ENABLED(),
+ });
const onFormSubmit = async ({ name }: TCreateOrganisationFormSchema) => {
try {
diff --git a/packages/lib/server-only/public-api/get-api-token-by-id.ts b/packages/lib/server-only/public-api/get-api-token-by-id.ts
deleted file mode 100644
index 8b25717f9..000000000
--- a/packages/lib/server-only/public-api/get-api-token-by-id.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { prisma } from '@documenso/prisma';
-
-export type GetApiTokenByIdOptions = {
- id: number;
- userId: number;
-};
-
-export const getApiTokenById = async ({ id, userId }: GetApiTokenByIdOptions) => {
- return await prisma.apiToken.findFirstOrThrow({
- where: {
- id,
- userId,
- },
- });
-};
diff --git a/packages/lib/server-only/public-api/get-api-tokens.ts b/packages/lib/server-only/public-api/get-api-tokens.ts
index 2effe863f..06e014a10 100644
--- a/packages/lib/server-only/public-api/get-api-tokens.ts
+++ b/packages/lib/server-only/public-api/get-api-tokens.ts
@@ -11,7 +11,6 @@ export type GetApiTokensOptions = {
export const getApiTokens = async ({ userId, teamId }: GetApiTokensOptions) => {
return await prisma.apiToken.findMany({
where: {
- userId,
team: buildTeamWhereQuery({
teamId,
userId,
diff --git a/packages/trpc/server/api-token-router/router.ts b/packages/trpc/server/api-token-router/router.ts
index de4cb4138..778c07b9a 100644
--- a/packages/trpc/server/api-token-router/router.ts
+++ b/packages/trpc/server/api-token-router/router.ts
@@ -1,31 +1,15 @@
import { createApiToken } from '@documenso/lib/server-only/public-api/create-api-token';
import { deleteTokenById } from '@documenso/lib/server-only/public-api/delete-api-token-by-id';
-import { getApiTokenById } from '@documenso/lib/server-only/public-api/get-api-token-by-id';
import { getApiTokens } from '@documenso/lib/server-only/public-api/get-api-tokens';
import { authenticatedProcedure, router } from '../trpc';
-import {
- ZCreateTokenMutationSchema,
- ZDeleteTokenByIdMutationSchema,
- ZGetApiTokenByIdQuerySchema,
-} from './schema';
+import { ZCreateTokenMutationSchema, ZDeleteTokenByIdMutationSchema } from './schema';
export const apiTokenRouter = router({
getTokens: authenticatedProcedure.query(async ({ ctx }) => {
return await getApiTokens({ userId: ctx.user.id, teamId: ctx.teamId });
}),
- getTokenById: authenticatedProcedure
- .input(ZGetApiTokenByIdQuerySchema)
- .query(async ({ input, ctx }) => {
- const { id } = input;
-
- return await getApiTokenById({
- id,
- userId: ctx.user.id,
- });
- }),
-
createToken: authenticatedProcedure
.input(ZCreateTokenMutationSchema)
.mutation(async ({ input, ctx }) => {
diff --git a/packages/trpc/server/api-token-router/schema.ts b/packages/trpc/server/api-token-router/schema.ts
index 32afed4a7..85c41d956 100644
--- a/packages/trpc/server/api-token-router/schema.ts
+++ b/packages/trpc/server/api-token-router/schema.ts
@@ -1,11 +1,5 @@
import { z } from 'zod';
-export const ZGetApiTokenByIdQuerySchema = z.object({
- id: z.number().min(1),
-});
-
-export type TGetApiTokenByIdQuerySchema = z.infer<typeof ZGetApiTokenByIdQuerySchema>;
-
export const ZCreateTokenMutationSchema = z.object({
teamId: z.number(),
tokenName: z.string().min(3, { message: 'The token name should be 3 characters or longer' }),