From da81381d62e08af19b1635afe1233dd6a3feb864 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 4 Dec 2024 13:48:30 +0000 Subject: [PATCH] PR review comments. --- packages/server/src/api/controllers/integration.ts | 2 +- packages/server/src/api/controllers/plugin/file.ts | 4 ++-- packages/server/src/sdk/plugins/plugins.ts | 4 ++-- packages/types/src/documents/global/plugin.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/server/src/api/controllers/integration.ts b/packages/server/src/api/controllers/integration.ts index 9f770ad049..f26f8dcc52 100644 --- a/packages/server/src/api/controllers/integration.ts +++ b/packages/server/src/api/controllers/integration.ts @@ -26,7 +26,7 @@ export async function find(ctx: UserCtx) { } const integration = await getDefinition(ctx.params.type) if (!integration) { - ctx.throw(400, "Integration not found") + ctx.throw(404, "Integration not found") } ctx.body = integration } diff --git a/packages/server/src/api/controllers/plugin/file.ts b/packages/server/src/api/controllers/plugin/file.ts index 0f40998617..4b1f098939 100644 --- a/packages/server/src/api/controllers/plugin/file.ts +++ b/packages/server/src/api/controllers/plugin/file.ts @@ -3,9 +3,9 @@ import { getPluginMetadata, extractTarball, } from "../../../utilities/fileSystem" -import { FileType } from "@budibase/types" +import { KoaFile } from "@budibase/types" -export async function fileUpload(file: FileType) { +export async function fileUpload(file: KoaFile) { if (!file.name || !file.path) { throw new Error("File is not valid - cannot upload.") } diff --git a/packages/server/src/sdk/plugins/plugins.ts b/packages/server/src/sdk/plugins/plugins.ts index 650065b40c..63f2f22cd9 100644 --- a/packages/server/src/sdk/plugins/plugins.ts +++ b/packages/server/src/sdk/plugins/plugins.ts @@ -1,4 +1,4 @@ -import { FileType, Plugin, PluginSource, PluginType } from "@budibase/types" +import { KoaFile, Plugin, PluginSource, PluginType } from "@budibase/types" import { db as dbCore, objectStore, @@ -26,7 +26,7 @@ export async function fetch(type?: PluginType): Promise { } } -export async function processUploaded(plugin: FileType, source?: PluginSource) { +export async function processUploaded(plugin: KoaFile, source?: PluginSource) { const { metadata, directory } = await fileUpload(plugin) pluginCore.validate(metadata?.schema) diff --git a/packages/types/src/documents/global/plugin.ts b/packages/types/src/documents/global/plugin.ts index 5a7c701ae5..eeddc04e58 100644 --- a/packages/types/src/documents/global/plugin.ts +++ b/packages/types/src/documents/global/plugin.ts @@ -12,7 +12,7 @@ export enum PluginSource { URL = "URL", FILE = "File Upload", } -export interface FileType { +export interface KoaFile { path: string | null name: string | null }