Renames
This commit is contained in:
parent
b262deb7cf
commit
25607c8f3b
|
@ -1,6 +1,6 @@
|
||||||
import {
|
import {
|
||||||
CreateOAuth2ConfigRequest,
|
UpsertOAuth2ConfigRequest,
|
||||||
CreateOAuth2ConfigResponse,
|
UpsertOAuth2ConfigResponse,
|
||||||
Ctx,
|
Ctx,
|
||||||
FetchOAuth2ConfigsResponse,
|
FetchOAuth2ConfigsResponse,
|
||||||
OAuth2Config,
|
OAuth2Config,
|
||||||
|
@ -22,7 +22,7 @@ export async function fetch(ctx: Ctx<void, FetchOAuth2ConfigsResponse>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function create(
|
export async function create(
|
||||||
ctx: Ctx<CreateOAuth2ConfigRequest, CreateOAuth2ConfigResponse>
|
ctx: Ctx<UpsertOAuth2ConfigRequest, UpsertOAuth2ConfigResponse>
|
||||||
) {
|
) {
|
||||||
const { body } = ctx.request
|
const { body } = ctx.request
|
||||||
const newConfig: RequiredKeys<Omit<OAuth2Config, "id">> = {
|
const newConfig: RequiredKeys<Omit<OAuth2Config, "id">> = {
|
||||||
|
@ -38,7 +38,7 @@ export async function create(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function edit(
|
export async function edit(
|
||||||
ctx: Ctx<CreateOAuth2ConfigRequest, CreateOAuth2ConfigResponse>
|
ctx: Ctx<UpsertOAuth2ConfigRequest, UpsertOAuth2ConfigResponse>
|
||||||
) {
|
) {
|
||||||
const { body } = ctx.request
|
const { body } = ctx.request
|
||||||
const toUpdate: RequiredKeys<OAuth2Config> = {
|
const toUpdate: RequiredKeys<OAuth2Config> = {
|
||||||
|
|
|
@ -15,7 +15,7 @@ router.post(
|
||||||
router.put(
|
router.put(
|
||||||
"/api/oauth2/:id",
|
"/api/oauth2/:id",
|
||||||
authorized(PermissionType.BUILDER),
|
authorized(PermissionType.BUILDER),
|
||||||
createOAauth2ConfigValidator(),
|
oAuth2ConfigValidator(),
|
||||||
controller.create
|
controller.create
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { CreateOAuth2ConfigRequest, VirtualDocumentType } from "@budibase/types"
|
import { UpsertOAuth2ConfigRequest, VirtualDocumentType } from "@budibase/types"
|
||||||
import * as setup from "./utilities"
|
import * as setup from "./utilities"
|
||||||
import { generator } from "@budibase/backend-core/tests"
|
import { generator } from "@budibase/backend-core/tests"
|
||||||
|
|
||||||
describe("/oauth2", () => {
|
describe("/oauth2", () => {
|
||||||
let config = setup.getConfig()
|
let config = setup.getConfig()
|
||||||
|
|
||||||
function makeOAuth2Config(): CreateOAuth2ConfigRequest {
|
function makeOAuth2Config(): UpsertOAuth2ConfigRequest {
|
||||||
return {
|
return {
|
||||||
name: generator.guid(),
|
name: generator.guid(),
|
||||||
url: generator.url(),
|
url: generator.url(),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {
|
import {
|
||||||
CreateOAuth2ConfigRequest,
|
UpsertOAuth2ConfigRequest,
|
||||||
CreateOAuth2ConfigResponse,
|
UpsertOAuth2ConfigResponse,
|
||||||
FetchOAuth2ConfigsResponse,
|
FetchOAuth2ConfigsResponse,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { Expectations, TestAPI } from "./base"
|
import { Expectations, TestAPI } from "./base"
|
||||||
|
@ -13,10 +13,10 @@ export class OAuth2API extends TestAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
create = async (
|
create = async (
|
||||||
body: CreateOAuth2ConfigRequest,
|
body: UpsertOAuth2ConfigRequest,
|
||||||
expectations?: Expectations
|
expectations?: Expectations
|
||||||
) => {
|
) => {
|
||||||
return await this._post<CreateOAuth2ConfigResponse>("/api/oauth2", {
|
return await this._post<UpsertOAuth2ConfigResponse>("/api/oauth2", {
|
||||||
body,
|
body,
|
||||||
expectations: {
|
expectations: {
|
||||||
status: expectations?.status ?? 201,
|
status: expectations?.status ?? 201,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export interface OAuth2ConfigResponse {
|
interface OAuth2ConfigResponse {
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,13 @@ export interface FetchOAuth2ConfigsResponse {
|
||||||
configs: OAuth2ConfigResponse[]
|
configs: OAuth2ConfigResponse[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateOAuth2ConfigRequest {
|
export interface UpsertOAuth2ConfigRequest {
|
||||||
name: string
|
name: string
|
||||||
url: string
|
url: string
|
||||||
clientId: string
|
clientId: string
|
||||||
clientSecret: string
|
clientSecret: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateOAuth2ConfigResponse {
|
export interface UpsertOAuth2ConfigResponse {
|
||||||
config: OAuth2ConfigResponse
|
config: OAuth2ConfigResponse
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue