Preliminary Vercel integration

This commit is contained in:
Tuan Dang
2022-12-13 13:59:21 -05:00
parent 271c810692
commit 3e623922b4
19 changed files with 521 additions and 118 deletions
@@ -4,7 +4,6 @@ import axios from 'axios';
import { readFileSync } from 'fs';
import { IntegrationAuth, Integration } from '../models';
import { INTEGRATION_SET, ENV_DEV } from '../variables';
import { OAUTH_CLIENT_SECRET_HEROKU, OAUTH_TOKEN_URL_HEROKU } from '../config';
import { IntegrationService } from '../services';
import { getApps } from '../integrations';
@@ -31,17 +31,21 @@ interface PushSecret {
export const updateIntegration = async (req: Request, res: Response) => {
let integration;
// TODO: add integration-specific validation to ensure that each
// integration has the correct fields populated in [Integration]
try {
const { app, environment, isActive } = req.body;
const { app, environment, isActive, target } = req.body;
integration = await Integration.findOneAndUpdate(
{
_id: req.integration._id
},
{
app,
environment,
isActive
isActive,
app,
target
},
{
new: true
@@ -49,7 +53,6 @@ export const updateIntegration = async (req: Request, res: Response) => {
);
if (integration) {
// trigger event - push secrets
EventService.handleEvent({
event: eventPushSecrets({