Skip to content

Commit dafc9f7

Browse files
committed
Remove unused api endpoint
1 parent 88b3dc9 commit dafc9f7

File tree

2 files changed

+3
-42
lines changed
  • core/app/api/v0/c/[communitySlug]/site/[...ts-rest]
  • packages/contracts/src/resources

2 files changed

+3
-42
lines changed

core/app/api/v0/c/[communitySlug]/site/[...ts-rest]/route.ts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import type { User } from "lucia";
22
import type { NextRequest } from "next/server";
33

44
import { headers } from "next/headers";
5-
import { queryByTestId } from "@testing-library/react";
6-
import { createNextHandler, RequestValidationError, TsRestRequest } from "@ts-rest/serverless/next";
5+
import { createNextHandler, TsRestRequest } from "@ts-rest/serverless/next";
76
import { jsonObjectFrom } from "kysely/helpers/postgres";
87
import qs from "qs";
98
import { z } from "zod";
@@ -22,7 +21,7 @@ import type {
2221
ApiAccessPermissionConstraintsInput,
2322
LastModifiedBy,
2423
} from "db/types";
25-
import { filterSchema, siteApi, TOTAL_PUBS_COUNT_HEADER } from "contracts";
24+
import { siteApi, TOTAL_PUBS_COUNT_HEADER } from "contracts";
2625
import { ApiAccessScope, ApiAccessType, Capabilities, MembershipType } from "db/public";
2726

2827
import type { CapabilityTarget } from "~/lib/authorization/capabilities";
@@ -52,7 +51,6 @@ import {
5251
import { validateApiAccessToken } from "~/lib/server/apiAccessTokens";
5352
import { getCommunitySlug } from "~/lib/server/cache/getCommunitySlug";
5453
import { findCommunityBySlug } from "~/lib/server/community";
55-
import { getForm } from "~/lib/server/form";
5654
import { validateFilter } from "~/lib/server/pub-filters-validate";
5755
import { getPubType, getPubTypesForCommunity } from "~/lib/server/pubtype";
5856
import { getStages } from "~/lib/server/stages";
@@ -273,27 +271,6 @@ const parseQueryWithQsMiddleware: RequestMiddleware = (req) => {
273271
const handler = createNextHandler(
274272
siteApi,
275273
{
276-
forms: {
277-
get: async ({ params }) => {
278-
const { user, community } = await checkAuthorization({
279-
token: { scope: ApiAccessScope.community, type: ApiAccessType.read },
280-
cookies: true,
281-
});
282-
283-
const form = await getForm({
284-
id: params.formId,
285-
communityId: community.id,
286-
}).executeTakeFirst();
287-
288-
if (!form) {
289-
return { status: 404, body: "Form not found" };
290-
}
291-
return {
292-
status: 200,
293-
body: form,
294-
};
295-
},
296-
},
297274
pubs: {
298275
search: async ({ query }) => {
299276
const { user, community } = await checkAuthorization({

packages/contracts/src/resources/site.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
communitiesIdSchema,
2323
communityMembershipsSchema,
2424
coreSchemaTypeSchema,
25-
formsIdSchema,
2625
memberRoleSchema,
2726
pubFieldsSchema,
2827
pubsIdSchema,
@@ -37,7 +36,7 @@ import {
3736
import { stageConstraintSchema } from "db/types";
3837

3938
import type { Json } from "./types";
40-
import { CreatePubRequestBodyWithNulls, formSchema, jsonSchema } from "./types";
39+
import { CreatePubRequestBodyWithNulls, jsonSchema } from "./types";
4140

4241
export const TOTAL_PUBS_COUNT_HEADER = "x-total-pubs";
4342

@@ -680,21 +679,6 @@ export const zodErrorSchema = z.object({
680679

681680
export const siteApi = contract.router(
682681
{
683-
forms: {
684-
get: {
685-
method: "GET",
686-
path: "/forms/:formId",
687-
summary: "Get a form",
688-
description: "Get a form by ID",
689-
pathParams: z.object({
690-
formId: formsIdSchema,
691-
}),
692-
responses: {
693-
200: formSchema,
694-
404: z.literal("Form not found"),
695-
},
696-
},
697-
},
698682
pubs: {
699683
search: {
700684
method: "GET",

0 commit comments

Comments
 (0)