Skip to content

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

feat: used new pubsub method to publish

Mir Arif Hasan33e4a15830df
diff --cc packages/hoppscotch-backend/prisma/schema.prisma
index 7d88dbcf2,0d6e7c56d..255781ec4
--- a/packages/hoppscotch-backend/prisma/schema.prisma
+++ b/packages/hoppscotch-backend/prisma/schema.prisma
@@@ -79,12 -79,20 +79,22 @@@ model TeamEnvironment
}
model User {
- uid String @id @default(cuid())
- uid String @id @default(cuid())
- displayName String?
- email String?
- photoURL String?
- UserEnvironments UserEnvironment[]
++ uid String @id @default(cuid())
+ displayName String?
+ email String?
+ photoURL String?
+ currentRESTSession String?
+ currentGQLSession String?
++ UserEnvironments UserEnvironment[]
+ }
+
+ model UserEnvironment {
+ id String @id @default(cuid())
+ userUid String
+ user User @relation(fields: [userUid], references: [uid], onDelete: Cascade)
+ name String?
+ variables Json
+ isGlobal Boolean
}
enum TeamMemberRole {
diff --cc packages/hoppscotch-backend/src/pubsub/topicsDefs.ts
index 000000000,4a1fbcb27..d7bfa10d0
mode 000000,100644..100644
--- a/packages/hoppscotch-backend/src/pubsub/topicsDefs.ts
+++ b/packages/hoppscotch-backend/src/pubsub/topicsDefs.ts
@@@ -1,0 -1,10 +1,14 @@@
++import { User } from 'src/user/user.model';
+ import { UserEnvironment } from '../user-environment/user-environments.model';
+
+ // A custom message type that defines the topic and the corresponding payload.
+ // For every module that publishes a subscription add its type def and the possible subscription type.
+ export type TopicDef = {
+ [
+ topic: `user_environment/${string}/${'created' | 'updated' | 'deleted'}`
+ ]: UserEnvironment;
++ [
++ topic: `user/${string}/${'created' | 'updated' | 'deleted'}`
++ ]: User;
+ [topic: `user_environment/${string}/deleted_many`]: number;
+ };