1
0
Fork 0
mirror of synced 2024-06-30 20:10:54 +12:00
budibase/packages/server/src/api/controllers/integration.js

28 lines
858 B
JavaScript
Raw Normal View History

const { cloneDeep } = require("lodash")
2020-11-27 03:43:56 +13:00
const { definitions } = require("../../integrations")
const { getTenantId } = require("@budibase/backend-core/tenancy")
const { SourceNames } = require("../../definitions/datasource")
const googlesheets = require("../../integrations/googlesheets")
const env = require("../../environment")
2020-11-27 03:43:56 +13:00
2021-05-03 19:31:09 +12:00
exports.fetch = async function (ctx) {
2020-11-27 03:43:56 +13:00
ctx.status = 200
const defs = cloneDeep(definitions)
// for google sheets integration google verification
if (env.EXCLUDE_QUOTAS_TENANTS) {
const excludedTenants = env.EXCLUDE_QUOTAS_TENANTS.split(",")
const tenantId = getTenantId()
if (excludedTenants.includes(tenantId)) {
defs[SourceNames.GOOGLE_SHEETS] = googlesheets.schema
}
}
ctx.body = defs
2020-11-27 03:43:56 +13:00
}
2020-12-19 07:19:43 +13:00
2021-05-03 19:31:09 +12:00
exports.find = async function (ctx) {
2020-12-19 07:19:43 +13:00
ctx.status = 200
ctx.body = definitions[ctx.params.type]
}