diff --git a/packages/server/src/api/controllers/application.ts b/packages/server/src/api/controllers/application.ts index 6acdfcd465..e73058239b 100644 --- a/packages/server/src/api/controllers/application.ts +++ b/packages/server/src/api/controllers/application.ts @@ -52,6 +52,8 @@ import { FetchAppPackageResponse, DuplicateAppRequest, DuplicateAppResponse, + UpdateAppRequest, + UpdateAppResponse, } from "@budibase/types" import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts" import sdk from "../../sdk" @@ -450,7 +452,7 @@ export async function create(ctx: UserCtx) { // This endpoint currently operates as a PATCH rather than a PUT // Thus name and url fields are handled only if present export async function update( - ctx: UserCtx<{ name?: string; url?: string }, App> + ctx: UserCtx ) { const apps = (await dbCore.getAllApps({ dev: true })) as App[] // validation diff --git a/packages/server/src/tests/utilities/api/application.ts b/packages/server/src/tests/utilities/api/application.ts index d28df223b5..bb9357c893 100644 --- a/packages/server/src/tests/utilities/api/application.ts +++ b/packages/server/src/tests/utilities/api/application.ts @@ -5,6 +5,8 @@ import { type FetchAppDefinitionResponse, type FetchAppPackageResponse, DuplicateAppResponse, + UpdateAppRequest, + UpdateAppResponse, } from "@budibase/types" import { Expectations, TestAPI } from "./base" import { AppStatus } from "../../../db/utils" @@ -109,11 +111,11 @@ export class ApplicationAPI extends TestAPI { update = async ( appId: string, - app: { name?: string; url?: string }, + app: UpdateAppRequest, expectations?: Expectations - ): Promise => { + ): Promise => { return await this._put(`/api/applications/${appId}`, { - fields: app, + body: app, expectations, }) } diff --git a/packages/types/src/api/web/application.ts b/packages/types/src/api/web/application.ts index 68c349be5a..bb4d8c7f72 100644 --- a/packages/types/src/api/web/application.ts +++ b/packages/types/src/api/web/application.ts @@ -44,3 +44,6 @@ export interface PublishResponse { status: string appUrl: string } + +export interface UpdateAppRequest extends Partial {} +export interface UpdateAppResponse extends App {}