requested changes

This commit is contained in:
Daniel Hougaard
2025-07-22 02:15:21 +04:00
parent 185cc4efba
commit bfd8b64871
4 changed files with 11 additions and 13 deletions
@@ -2,7 +2,7 @@ import fastifyMultipart from "@fastify/multipart";
import { z } from "zod";
import { BadRequestError } from "@app/lib/errors";
import { readLimit } from "@app/server/config/rateLimiter";
import { writeLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
import { VaultMappingType } from "@app/services/external-migration/external-migration-types";
@@ -17,7 +17,7 @@ export const registerExternalMigrationRouter = async (server: FastifyZodProvider
bodyLimit: MB25_IN_BYTES,
url: "/env-key",
config: {
rateLimit: readLimit
rateLimit: writeLimit
},
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req) => {
@@ -59,7 +59,7 @@ export const registerExternalMigrationRouter = async (server: FastifyZodProvider
method: "POST",
url: "/vault",
config: {
rateLimit: readLimit
rateLimit: writeLimit
},
schema: {
body: z.object({
@@ -45,16 +45,19 @@ export const useImportVault = () => {
mutationFn: async ({
vaultAccessToken,
vaultNamespace,
vaultUrl
vaultUrl,
mappingType
}: {
vaultAccessToken: string;
vaultNamespace: string;
vaultUrl: string;
mappingType: string;
}) => {
await apiRequest.post("/api/v3/external-migration/vault/", {
vaultAccessToken,
vaultNamespace,
vaultUrl
vaultUrl,
mappingType
});
}
});
@@ -6,7 +6,7 @@ import { AnimatePresence, motion } from "framer-motion";
import { Modal, ModalContent } from "@app/components/v2";
import { EnvKeyPlatformModal } from "./EnvKeyPlatformModal";
import { VaultPlatformModal } from "./VaultPlatformModal copy";
import { VaultPlatformModal } from "./VaultPlatformModal";
type Props = {
isOpen?: boolean;
@@ -69,8 +69,6 @@ export const VaultPlatformModal = ({ onClose }: Props) => {
});
type TFormData = z.infer<typeof formSchema>;
const fileUploadRef = useRef<HTMLInputElement>(null);
const { mutateAsync: importVault } = useImportVault();
const {
@@ -87,7 +85,8 @@ export const VaultPlatformModal = ({ onClose }: Props) => {
await importVault({
vaultAccessToken: data.vaultAccessToken,
vaultNamespace: data.vaultNamespace,
vaultUrl: data.vaultUrl
vaultUrl: data.vaultUrl,
mappingType: data.mappingType
});
createNotification({
title: "Import started",
@@ -97,10 +96,6 @@ export const VaultPlatformModal = ({ onClose }: Props) => {
onClose();
reset();
if (fileUploadRef.current) {
fileUploadRef.current.value = "";
}
} catch {
reset();
}