Skip to content

Commit

Permalink
feat: add operation id for submit
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobLinCool committed Jun 24, 2023
1 parent bf7b64d commit 93547ea
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"private": true,
"name": "@wasm-oj/wonderland",
"version": "0.0.1",
"type": "module",
Expand Down Expand Up @@ -67,7 +66,7 @@
"svelte-check": "^3.4.3",
"svelte-i18n": "^3.6.0",
"svelte-markdown": "^0.2.3",
"sveltekit-api": "^0.2.11",
"sveltekit-api": "^0.2.12",
"sveltekit-jwt": "^0.2.0",
"sveltekit-superforms": "^1.0.0-rc.4",
"tailwindcss": "^3.3.2",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/api/auth/shared.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RouteConfig } from "sveltekit-api";
import type { RouteModifier } from "sveltekit-api";

export const Modifier = (r: RouteConfig) => {
export const Modifier: RouteModifier = (r) => {
r.tags = ["Auth"];
return r;
};
4 changes: 2 additions & 2 deletions src/api/problem/shared.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RouteConfig } from "sveltekit-api";
import type { RouteModifier } from "sveltekit-api";

export const Modifier = (r: RouteConfig) => {
export const Modifier: RouteModifier = (r) => {
r.tags = ["Problem"];
return r;
};
5 changes: 3 additions & 2 deletions src/api/submission/POST.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { submit } from "$lib/server/submission";
import { sha256 } from "$lib/utils";
import { z } from "sveltekit-api";
import type { RouteConfig } from "sveltekit-api";
import type { RouteModifier } from "sveltekit-api";
import { error } from "@sveltejs/kit";
import type { RequestEvent } from "@sveltejs/kit";
import { Modifier as _Modifier } from "./shared";
Expand All @@ -25,9 +25,10 @@ export const Error = {
401: error(401, "Unauthorized"),
};

export const Modifier = (r: RouteConfig) => {
export const Modifier: RouteModifier = (r) => {
_Modifier(r);
r.security = [{ bearerAuth: [] }];
r.operationId = "submit";
return r;
};

Expand Down
4 changes: 2 additions & 2 deletions src/api/submission/shared.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RouteConfig } from "sveltekit-api";
import type { RouteModifier } from "sveltekit-api";

export const Modifier = (r: RouteConfig) => {
export const Modifier: RouteModifier = (r) => {
r.tags = ["Submission"];
return r;
};
2 changes: 1 addition & 1 deletion src/routes/api/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import type { RequestHandler } from "./$types";
export const GET = (async ({ url }) => {
const doc = new URL(url);
doc.pathname = "/api/openapi.json";
throw redirect(301, `https://api-spec.pages.dev/x?url=${doc.toString()}`);
throw redirect(301, `https://api-spec.pages.dev/rapidoc?url=${doc.toString()}`);
}) satisfies RequestHandler;

0 comments on commit 93547ea

Please sign in to comment.