2022-03-28 17:44:33 +02:00
|
|
|
const { cloneDeep } = require("lodash")
|
2020-11-26 15:43:56 +01:00
|
|
|
const { definitions } = require("../../integrations")
|
2022-03-28 17:44:33 +02:00
|
|
|
const { getTenantId } = require("@budibase/backend-core/tenancy")
|
|
|
|
const { SourceNames } = require("../../definitions/datasource")
|
|
|
|
const googlesheets = require("../../integrations/googlesheets")
|
|
|
|
const env = require("../../environment")
|
2020-11-26 15:43:56 +01:00
|
|
|
|
2021-05-03 09:31:09 +02:00
|
|
|
exports.fetch = async function (ctx) {
|
2020-11-26 15:43:56 +01:00
|
|
|
ctx.status = 200
|
2022-03-28 17:44:33 +02:00
|
|
|
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-26 15:43:56 +01:00
|
|
|
}
|
2020-12-18 19:19:43 +01:00
|
|
|
|
2021-05-03 09:31:09 +02:00
|
|
|
exports.find = async function (ctx) {
|
2020-12-18 19:19:43 +01:00
|
|
|
ctx.status = 200
|
|
|
|
ctx.body = definitions[ctx.params.type]
|
|
|
|
}
|