mirror of
https://github.com/dadosfera/maestro.git
synced 2026-08-31 19:58:21 +00:00
FEAT: Update OAuth Connection
This commit is contained in:
+1
-1
@@ -3297,7 +3297,7 @@
|
||||
}
|
||||
},
|
||||
"info": {
|
||||
"title": "Maestro - fix/refresh-token",
|
||||
"title": "Maestro - feat/update-connection",
|
||||
"description": "Documentation for Maestro gateway",
|
||||
"version": "1.0.0",
|
||||
"contact": {}
|
||||
|
||||
@@ -148,10 +148,16 @@ export class OauthController {
|
||||
const { customer_id, customer_name, user_id } = connectionInfo;
|
||||
|
||||
try {
|
||||
const response = await this.connectionService.createConnection(
|
||||
connectionInfo,
|
||||
PackTheMetadata({ customer_id, customer_name, user_id }),
|
||||
);
|
||||
const response = connectionInfo.id
|
||||
? await this.connectionService.updateConnection(
|
||||
connectionInfo.id,
|
||||
connectionInfo,
|
||||
PackTheMetadata({ customer_id, customer_name, user_id }),
|
||||
)
|
||||
: await this.connectionService.createConnection(
|
||||
connectionInfo,
|
||||
PackTheMetadata({ customer_id, customer_name, user_id }),
|
||||
);
|
||||
url.searchParams.set('connection_id', response.connection.id);
|
||||
return { url: url.href };
|
||||
} catch (error) {
|
||||
|
||||
@@ -23,6 +23,7 @@ export class OauthService {
|
||||
user_id,
|
||||
customer_id,
|
||||
customer_name,
|
||||
id,
|
||||
} = query;
|
||||
|
||||
const properties = { plugin, credentials_type: 'oauth' };
|
||||
@@ -45,6 +46,7 @@ export class OauthService {
|
||||
type,
|
||||
properties,
|
||||
plugin,
|
||||
id,
|
||||
};
|
||||
return jwt.sign({ ...newConnection }, process.env.JWT_PRIVATE_KEY);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user