Correct types for application updating.
This commit is contained in:
parent
7b57595a1e
commit
6f23877764
|
@ -52,6 +52,8 @@ import {
|
||||||
FetchAppPackageResponse,
|
FetchAppPackageResponse,
|
||||||
DuplicateAppRequest,
|
DuplicateAppRequest,
|
||||||
DuplicateAppResponse,
|
DuplicateAppResponse,
|
||||||
|
UpdateAppRequest,
|
||||||
|
UpdateAppResponse,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts"
|
import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts"
|
||||||
import sdk from "../../sdk"
|
import sdk from "../../sdk"
|
||||||
|
@ -450,7 +452,7 @@ export async function create(ctx: UserCtx<CreateAppRequest, App>) {
|
||||||
// This endpoint currently operates as a PATCH rather than a PUT
|
// This endpoint currently operates as a PATCH rather than a PUT
|
||||||
// Thus name and url fields are handled only if present
|
// Thus name and url fields are handled only if present
|
||||||
export async function update(
|
export async function update(
|
||||||
ctx: UserCtx<{ name?: string; url?: string }, App>
|
ctx: UserCtx<UpdateAppRequest, UpdateAppResponse>
|
||||||
) {
|
) {
|
||||||
const apps = (await dbCore.getAllApps({ dev: true })) as App[]
|
const apps = (await dbCore.getAllApps({ dev: true })) as App[]
|
||||||
// validation
|
// validation
|
||||||
|
|
|
@ -5,6 +5,8 @@ import {
|
||||||
type FetchAppDefinitionResponse,
|
type FetchAppDefinitionResponse,
|
||||||
type FetchAppPackageResponse,
|
type FetchAppPackageResponse,
|
||||||
DuplicateAppResponse,
|
DuplicateAppResponse,
|
||||||
|
UpdateAppRequest,
|
||||||
|
UpdateAppResponse,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { Expectations, TestAPI } from "./base"
|
import { Expectations, TestAPI } from "./base"
|
||||||
import { AppStatus } from "../../../db/utils"
|
import { AppStatus } from "../../../db/utils"
|
||||||
|
@ -109,11 +111,11 @@ export class ApplicationAPI extends TestAPI {
|
||||||
|
|
||||||
update = async (
|
update = async (
|
||||||
appId: string,
|
appId: string,
|
||||||
app: { name?: string; url?: string },
|
app: UpdateAppRequest,
|
||||||
expectations?: Expectations
|
expectations?: Expectations
|
||||||
): Promise<App> => {
|
): Promise<UpdateAppResponse> => {
|
||||||
return await this._put<App>(`/api/applications/${appId}`, {
|
return await this._put<App>(`/api/applications/${appId}`, {
|
||||||
fields: app,
|
body: app,
|
||||||
expectations,
|
expectations,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,3 +44,6 @@ export interface PublishResponse {
|
||||||
status: string
|
status: string
|
||||||
appUrl: string
|
appUrl: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface UpdateAppRequest extends Partial<App> {}
|
||||||
|
export interface UpdateAppResponse extends App {}
|
||||||
|
|
Loading…
Reference in New Issue