Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

chore: removed subscription handler related files

ankitsridhar160bed5cd99a51
diff --git a/packages/hoppscotch-backend/src/subscription-handler.ts b/packages/hoppscotch-backend/src/subscription-handler.ts
deleted file mode 100644
index a47730c3b..000000000
--- a/packages/hoppscotch-backend/src/subscription-handler.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { Injectable } from '@nestjs/common';
-import { PubSubService } from './pubsub/pubsub.service';
-import { PrimitiveTypes } from './types/primitive-types';
-import { CustomModuleTypes } from './types/custom-module-types';
-import { SubscriptionType } from './types/subscription-types';
-
-// Custom generic type to indicate the type of module
-type ModuleType = PrimitiveTypes | CustomModuleTypes;
-
-@Injectable()
-export class SubscriptionHandler {
- constructor(private readonly pubsub: PubSubService) {}
-
- /**
- * Publishes a subscription using the pubsub module
- * @param topic a string containing the "module_name/identifier"
- * @param subscriptionType type of subscription being published
- * @param moduleType type of the module model being called
- * @returns a promise of type void
- */
- async publish(
- topic: string,
- subscriptionType: SubscriptionType,
- moduleType: ModuleType,
- ) {
- switch (subscriptionType) {
- case SubscriptionType.Created:
- await this.pubsub.publish(`${topic}/created`, moduleType);
- break;
- case SubscriptionType.Updated:
- await this.pubsub.publish(`${topic}/updated`, moduleType);
- break;
- case SubscriptionType.Deleted:
- await this.pubsub.publish(`${topic}/deleted`, moduleType);
- break;
- case SubscriptionType.DeleteMany:
- await this.pubsub.publish(`${topic}/delete_many`, moduleType);
- break;
- default:
- break;
- }
- }
-}
diff --git a/packages/hoppscotch-backend/src/types/custom-module-types.ts b/packages/hoppscotch-backend/src/types/custom-module-types.ts
deleted file mode 100644
index 5d669e075..000000000
--- a/packages/hoppscotch-backend/src/types/custom-module-types.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import { UserEnvironment } from '../user-environment/user-environments.model';
-import { User } from '../user/user.model';
-
-export type CustomModuleTypes = UserEnvironment | User;
diff --git a/packages/hoppscotch-backend/src/types/subscription-types.ts b/packages/hoppscotch-backend/src/types/subscription-types.ts
deleted file mode 100644
index ee7ab75f2..000000000
--- a/packages/hoppscotch-backend/src/types/subscription-types.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-// Contains constants for the subscription types we use in Subscription Handler
-export enum SubscriptionType {
- Created = 'created',
- Updated = 'updated',
- Deleted = 'deleted',
- DeleteMany = 'delete_many',
-}