From d066b9c9136d1c8f4711d71130c7bbc4b92818d2 Mon Sep 17 00:00:00 2001 From: ankitsridhar16 Date: Tue, 20 Dec 2022 14:28:15 +0530 Subject: [PATCH] feat: added prisma schema for user history --- .../hoppscotch-backend/prisma/schema.prisma | 25 ++++++++++++++++--- .../src/prisma/prisma.service.ts | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/packages/hoppscotch-backend/prisma/schema.prisma b/packages/hoppscotch-backend/prisma/schema.prisma index 947d158a8..2fc841fff 100644 --- a/packages/hoppscotch-backend/prisma/schema.prisma +++ b/packages/hoppscotch-backend/prisma/schema.prisma @@ -79,10 +79,27 @@ 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? + UserHistory UserHistory[] +} + +model UserHistory { + id String @id @default(cuid()) + userUid String + user User @relation(fields: [userUid], references: [uid], onDelete: Cascade) + type ReqType + request Json + responseMetadata Json + isStarred Boolean + executedOn DateTime @default(now()) +} + +enum ReqType { + REST + GQL } enum TeamMemberRole { diff --git a/packages/hoppscotch-backend/src/prisma/prisma.service.ts b/packages/hoppscotch-backend/src/prisma/prisma.service.ts index 5b962c430..8febf1b5b 100644 --- a/packages/hoppscotch-backend/src/prisma/prisma.service.ts +++ b/packages/hoppscotch-backend/src/prisma/prisma.service.ts @@ -1,5 +1,5 @@ import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common'; -import { PrismaClient } from '@prisma/client/scripts/default-index'; +import { PrismaClient } from '@prisma/client'; @Injectable() export class PrismaService