summary refs log tree commit diff
path: root/src/util/connections/Connection.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-12-23 12:44:04 +1100
committerPuyodead1 <puyodead@proton.me>2023-03-18 19:23:20 -0400
commita4961800d7b6b37864b7b7c44893c734ef1b05ae (patch)
treec633c3de4d901e3ac5e4742220d06874a5702810 /src/util/connections/Connection.ts
parentimplement PATCH connection (diff)
downloadserver-a4961800d7b6b37864b7b7c44893c734ef1b05ae.tar.xz
`handleCallback` returns connection if created for `USER_CONNECTIONS_UPDATE`
Diffstat (limited to 'src/util/connections/Connection.ts')
-rw-r--r--src/util/connections/Connection.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/util/connections/Connection.ts b/src/util/connections/Connection.ts
index e8d41c36..164cfac7 100644
--- a/src/util/connections/Connection.ts
+++ b/src/util/connections/Connection.ts
@@ -21,7 +21,7 @@ export default abstract class Connection {
 	 * Processes the callback
 	 * @param args Callback arguments
 	 */
-	abstract handleCallback(params: ConnectionCallbackSchema): Promise<boolean>;
+	abstract handleCallback(params: ConnectionCallbackSchema): Promise<ConnectedAccount | null>;
 
 	/**
 	 * Gets a user id from state
@@ -54,9 +54,10 @@ export default abstract class Connection {
 		this.states.delete(state);
 	}
 
-	async createConnection(data: ConnectedAccountSchema): Promise<void> {
-		const ca = OrmUtils.mergeDeep(new ConnectedAccount(), data);
+	async createConnection(data: ConnectedAccountSchema): Promise<ConnectedAccount> {
+		const ca = OrmUtils.mergeDeep(new ConnectedAccount(), data) as ConnectedAccount;
 		await ca.save();
+		return ca;
 	}
 
 	async hasConnection(userId: string, externalId: string): Promise<boolean> {