Types for sending quota triggered email
This commit is contained in:
parent
816cacbc00
commit
51f2a3b86c
|
@ -1 +1,2 @@
|
|||
export * from "./user"
|
||||
export * from "./license"
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import { QuotaUsage } from "../../documents"
|
||||
|
||||
export interface GetLicenseRequest {
|
||||
quotaUsage: QuotaUsage
|
||||
}
|
||||
|
||||
export interface QuotaUsageTriggeredRequest {
|
||||
percentage: number
|
||||
name: string
|
||||
resetDate: string
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
import { Feature, Hosting, PlanType, Quotas } from "../../sdk"
|
||||
import { QuotaUsage } from "../global"
|
||||
|
||||
export interface CreateAccount {
|
||||
email: string
|
||||
|
@ -42,6 +43,7 @@ export interface Account extends CreateAccount {
|
|||
licenseKey?: string
|
||||
licenseKeyActivatedAt?: number
|
||||
licenseOverrides?: LicenseOverrides
|
||||
quotaUsage?: QuotaUsage
|
||||
}
|
||||
|
||||
export interface PasswordAccount extends Account {
|
||||
|
|
|
@ -16,9 +16,7 @@ class InternalAPIClient {
|
|||
|
||||
constructor(appId?: string) {
|
||||
if (!env.BUDIBASE_SERVER_URL) {
|
||||
throw new Error(
|
||||
"Must set BUDIBASE_SERVER_URL env var"
|
||||
)
|
||||
throw new Error("Must set BUDIBASE_SERVER_URL env var")
|
||||
}
|
||||
this.host = `${env.BUDIBASE_SERVER_URL}/api`
|
||||
this.appId = appId
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import {
|
||||
Application,
|
||||
} from "@budibase/server/api/controllers/public/mapping/types"
|
||||
import { Application } from "@budibase/server/api/controllers/public/mapping/types"
|
||||
import { App } from "@budibase/types"
|
||||
import { Response } from "node-fetch"
|
||||
import InternalAPIClient from "./InternalAPIClient"
|
||||
|
@ -37,9 +35,7 @@ export default class AppApi {
|
|||
return [response, json]
|
||||
}
|
||||
|
||||
async create(
|
||||
body: any
|
||||
): Promise<[Response, Partial<App>]> {
|
||||
async create(body: any): Promise<[Response, Partial<App>]> {
|
||||
const response = await this.api.post(`/applications`, { body })
|
||||
const json = await response.json()
|
||||
return [response, json]
|
||||
|
|
|
@ -12,8 +12,8 @@ export default class AuthApi {
|
|||
const response = await this.api.post(`/global/auth/default/login`, {
|
||||
body: {
|
||||
username: process.env.BB_ADMIN_USER_EMAIL,
|
||||
password: process.env.BB_ADMIN_USER_PASSWORD
|
||||
}
|
||||
password: process.env.BB_ADMIN_USER_PASSWORD,
|
||||
},
|
||||
})
|
||||
const cookie = response.headers.get("set-cookie")
|
||||
this.api.cookie = cookie as any
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import generator from "../../generator"
|
||||
import {
|
||||
Application,
|
||||
} from "@budibase/server/api/controllers/public/mapping/types"
|
||||
import { Application } from "@budibase/server/api/controllers/public/mapping/types"
|
||||
|
||||
|
||||
const generate = (overrides: Partial<Application> = {}): Partial<Application> => ({
|
||||
const generate = (
|
||||
overrides: Partial<Application> = {}
|
||||
): Partial<Application> => ({
|
||||
name: generator.word(),
|
||||
url: `/${generator.word()}`,
|
||||
...overrides,
|
||||
|
|
|
@ -24,14 +24,14 @@ describe("Internal API - /applications endpoints", () => {
|
|||
useTemplate: "true",
|
||||
templateName: "Near Miss Register",
|
||||
templateKey: "app/near-miss-register",
|
||||
templateFile: undefined
|
||||
templateFile: undefined,
|
||||
})
|
||||
}
|
||||
|
||||
it("GET - fetch applications", async () => {
|
||||
await config.applications.create({
|
||||
...generateApp(),
|
||||
useTemplate: false
|
||||
useTemplate: false,
|
||||
})
|
||||
const [response, apps] = await config.applications.fetch()
|
||||
expect(response).toHaveStatusCode(200)
|
||||
|
@ -57,7 +57,7 @@ describe("Internal API - /applications endpoints", () => {
|
|||
expect(publish).toEqual({
|
||||
_id: expect.any(String),
|
||||
appUrl: app.url,
|
||||
status: "SUCCESS"
|
||||
status: "SUCCESS",
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -70,7 +70,8 @@ describe("Internal API - /applications endpoints", () => {
|
|||
config.applications.api.appId = app.appId
|
||||
|
||||
// check preview renders
|
||||
const [previewResponse, previewRenders] = await config.applications.canRender()
|
||||
const [previewResponse, previewRenders] =
|
||||
await config.applications.canRender()
|
||||
expect(previewResponse).toHaveStatusCode(200)
|
||||
expect(previewRenders).toBe(true)
|
||||
|
||||
|
@ -79,8 +80,8 @@ describe("Internal API - /applications endpoints", () => {
|
|||
|
||||
// check published app renders
|
||||
config.applications.api.appId = db.getProdAppID(app.appId)
|
||||
const [publishedAppResponse, publishedAppRenders] = await config.applications.canRender()
|
||||
const [publishedAppResponse, publishedAppRenders] =
|
||||
await config.applications.canRender()
|
||||
expect(publishedAppRenders).toBe(true)
|
||||
})
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue