From b677aa1715d0a35897627d785a6b3c72762bc78a Mon Sep 17 00:00:00 2001 From: ankitsridhar16 Date: Tue, 20 Dec 2022 14:30:14 +0530 Subject: [PATCH] feat: added user history model --- .../src/user-history/user-history.model.ts | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 packages/hoppscotch-backend/src/user-history/user-history.model.ts diff --git a/packages/hoppscotch-backend/src/user-history/user-history.model.ts b/packages/hoppscotch-backend/src/user-history/user-history.model.ts new file mode 100644 index 000000000..493646466 --- /dev/null +++ b/packages/hoppscotch-backend/src/user-history/user-history.model.ts @@ -0,0 +1,49 @@ +import { Field, ID, ObjectType, registerEnumType } from '@nestjs/graphql'; + +@ObjectType() +export class UserHistory { + @Field(() => ID, { + description: 'ID of the user request in history', + }) + id: string; + + @Field(() => ID, { + description: 'ID of the user this history belongs to', + }) + userUid: string; + + @Field(() => ReqType, { + description: 'Type of the request in the history', + }) + reqType: ReqType; + + @Field({ + description: 'JSON string representing the request data', + }) + request: string; + + @Field({ + description: 'JSON string representing the response meta-data', + }) + responseMetadata: string; + + @Field({ + description: 'If the request in the history starred', + }) + isStarred: boolean; + + @Field({ + description: + 'Timestamp of when the request was executed or history was created', + }) + executedOn: Date; +} + +export enum ReqType { + REST = 'REST', + GQL = 'GQL', +} + +registerEnumType(ReqType, { + name: 'ReqType', +});