feat: Implement telemetry for connection creation and updates

This commit is contained in:
Faruk AYDIN
2022-05-05 01:34:26 +02:00
parent 00b8f83da5
commit 21836bc5f1
2 changed files with 32 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import Base from './base';
import User from './user';
import appConfig from '../config/app';
import { IJSONObject } from '@automatisch/types';
import Telemetry from '../helpers/telemetry';
class Connection extends Base {
id!: string;
@@ -87,6 +88,16 @@ class Connection extends Base {
async $afterFind(): Promise<void> {
this.decryptData();
}
async $afterInsert(queryContext: QueryContext) {
await super.$afterInsert(queryContext);
Telemetry.connectionCreated(this);
}
async $afterUpdate(opt: ModelOptions, queryContext: QueryContext) {
await super.$afterUpdate(opt, queryContext);
Telemetry.connectionUpdated(this);
}
}
export default Connection;