Finish Netlify integration v1 full-loop

This commit is contained in:
Tuan Dang
2022-12-14 18:18:21 -05:00
parent fe17d8459b
commit 787e54fb91
14 changed files with 441 additions and 108 deletions
@@ -51,7 +51,7 @@ export const getIntegrationAuthApps = async (req: Request, res: Response) => {
let apps;
try {
apps = await getApps({
integration: req.integrationAuth.integration,
integrationAuth: req.integrationAuth,
accessToken: req.accessToken
});
} catch (err) {
@@ -35,8 +35,15 @@ export const updateIntegration = async (req: Request, res: Response) => {
// integration has the correct fields populated in [Integration]
try {
const { app, environment, isActive, target } = req.body;
const {
app,
environment,
isActive,
target, // vercel-specific integration param
context, // netlify-specific integration param
siteId // netlify-specific integration param
} = req.body;
integration = await Integration.findOneAndUpdate(
{
_id: req.integration._id
@@ -45,7 +52,9 @@ export const updateIntegration = async (req: Request, res: Response) => {
environment,
isActive,
app,
target
target,
context,
siteId
},
{
new: true