Skip to content

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

Merge remote-tracking branch 'origin/main' into feat/user-history

ankitsridhar167d98c1b3556e
diff --cc packages/hoppscotch-backend/prisma/schema.prisma
index ae8574a64,6165b3d6a..f899da360
--- a/packages/hoppscotch-backend/prisma/schema.prisma
+++ b/packages/hoppscotch-backend/prisma/schema.prisma
@@@ -79,30 -79,22 +79,40 @@@ model TeamEnvironment
}
model User {
- uid String @id @default(cuid())
- displayName String?
- email String?
- photoURL String?
+ uid String @id @default(cuid())
+ displayName String?
+ email String?
+ photoURL String?
+ settings UserSettings?
++
+ UserHistory UserHistory[]
UserEnvironments UserEnvironment[]
}
+ model UserSettings {
+ id String @id @default(cuid())
+ userUid String @unique
+ user User @relation(fields: [userUid], references: [uid], onDelete: Cascade)
+ properties Json
+ updatedOn DateTime @updatedAt @db.Timestamp(3)
+ }
+
+model UserHistory {
+ id String @id @default(cuid())
+ userUid String
+ user User @relation(fields: [userUid], references: [uid], onDelete: Cascade)
+ reqType ReqType
+ request Json
+ responseMetadata Json
+ isStarred Boolean
+ executedOn DateTime @default(now()) @db.Timestamp(3)
+}
+
+enum ReqType {
+ REST
+ GQL
+}
+
model UserEnvironment {
id String @id @default(cuid())
userUid String
diff --cc packages/hoppscotch-backend/src/app.module.ts
index bd6b8d47a,3ba7c17b2..80d1d83b4
--- a/packages/hoppscotch-backend/src/app.module.ts
+++ b/packages/hoppscotch-backend/src/app.module.ts
@@@ -3,8 -3,8 +3,9 @@@ import { GraphQLModule } from '@nestjs/
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
import { UserModule } from './user/user.module';
import { GQLComplexityPlugin } from './plugins/GQLComplexityPlugin';
+ import { UserSettingsModule } from './user-settings/user-settings.module';
import { UserEnvironmentsModule } from './user-environment/user-environments.module';
+import { UserHistoryModule } from './user-history/user-history.module';
@Module({
imports: [
@@@ -46,8 -46,8 +47,9 @@@
driver: ApolloDriver,
}),
UserModule,
+ UserSettingsModule,
UserEnvironmentsModule,
+ UserHistoryModule,
],
providers: [GQLComplexityPlugin],
})
diff --cc packages/hoppscotch-backend/src/pubsub/topicsDefs.ts
index 642740577,d55033582..8254b1841
--- a/packages/hoppscotch-backend/src/pubsub/topicsDefs.ts
+++ b/packages/hoppscotch-backend/src/pubsub/topicsDefs.ts
@@@ -1,5 -1,5 +1,6 @@@
+ import { UserSettings } from 'src/user-settings/user-settings.model';
import { UserEnvironment } from '../user-environment/user-environments.model';
+import { UserHistory } from '../user-history/user-history.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.
@@@ -7,9 -7,6 +8,10 @@@ export type TopicDef =
[
topic: `user_environment/${string}/${'created' | 'updated' | 'deleted'}`
]: UserEnvironment;
+ [topic: `user_settings/${string}/${'created' | 'updated'}`]: UserSettings;
[topic: `user_environment/${string}/deleted_many`]: number;
+ [
+ topic: `user_history/${string}/${'created' | 'updated' | 'deleted'}`
+ ]: UserHistory;
+ [topic: `user_history/${string}/deleted_many`]: number;
};