budibase/packages/server/src/api/controllers/integration.js

23 lines
691 B
JavaScript
Raw Normal View History

const { cloneDeep } = require("lodash")
2020-11-26 15:43:56 +01:00
const { definitions } = require("../../integrations")
const { SourceNames } = require("../../definitions/datasource")
const googlesheets = require("../../integrations/googlesheets")
2022-05-05 10:59:10 +02:00
const { featureFlags } = require("@budibase/backend-core")
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
const defs = cloneDeep(definitions)
// for google sheets integration google verification
2022-05-05 10:59:10 +02:00
if (featureFlags.isEnabled(featureFlags.FeatureFlag.GOOGLE_SHEETS)) {
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]
}