From c0978c3b20fb1d74049155be4f6006e3f5b79d23 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Sat, 24 Feb 2024 17:48:09 +0530 Subject: [PATCH] refactor: eliminate `parentCollectionID` field from `RESTCollectionViewRequest` type Collection ID serves the purpose. --- .../src/components/new-collections/rest/Request.vue | 5 ++--- .../src/components/new-collections/rest/index.vue | 12 ++++++------ .../new-workspace/providers/personal.workspace.ts | 5 +---- .../src/services/new-workspace/view.ts | 1 - 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/packages/hoppscotch-common/src/components/new-collections/rest/Request.vue b/packages/hoppscotch-common/src/components/new-collections/rest/Request.vue index 50b26075f..3a385d3f5 100644 --- a/packages/hoppscotch-common/src/components/new-collections/rest/Request.vue +++ b/packages/hoppscotch-common/src/components/new-collections/rest/Request.vue @@ -256,8 +256,7 @@ const isReorderable = computed(() => { const isSameParent = computed(() => { return ( - currentReorderingStatus.value.parentID === - props.requestView.parentCollectionID + currentReorderingStatus.value.parentID === props.requestView.collectionID ) }) @@ -277,7 +276,7 @@ const dragStart = ({ dataTransfer }: DragEvent) => { changeCurrentReorderStatus({ type: "request", id: props.requestView.requestID, - parentID: props.requestView.parentCollectionID, + parentID: props.requestView.collectionID, }) } } diff --git a/packages/hoppscotch-common/src/components/new-collections/rest/index.vue b/packages/hoppscotch-common/src/components/new-collections/rest/index.vue index 48e45f64a..2446205dd 100644 --- a/packages/hoppscotch-common/src/components/new-collections/rest/index.vue +++ b/packages/hoppscotch-common/src/components/new-collections/rest/index.vue @@ -134,7 +134,7 @@ :save-request="saveRequest" @drag-request=" dragRequest($event, { - parentCollectionIndexPath: node.data.value.parentCollectionID, + parentCollectionIndexPath: node.data.value.collectionID, requestIndex: node.data.value.requestID, }) " @@ -146,13 +146,13 @@ @share-request="shareRequest" @update-request-order=" updateRequestOrder($event, { - parentCollectionIndexPath: node.data.value.parentCollectionID, + parentCollectionIndexPath: node.data.value.collectionID, requestIndex: node.data.value.requestID, }) " @update-last-request-order=" updateRequestOrder($event, { - parentCollectionIndexPath: node.data.value.parentCollectionID, + parentCollectionIndexPath: node.data.value.collectionID, requestIndex: null, }) " @@ -240,7 +240,7 @@ :save-request="saveRequest" @drag-request=" dragRequest($event, { - parentCollectionIndexPath: node.data.value.parentCollectionID, + parentCollectionIndexPath: node.data.value.collectionID, requestIndex: node.data.value.requestID, }) " @@ -252,13 +252,13 @@ @share-request="shareRequest" @update-request-order=" updateRequestOrder($event, { - parentCollectionIndexPath: node.data.value.parentCollectionID, + parentCollectionIndexPath: node.data.value.collectionID, requestIndex: node.data.value.requestID, }) " @update-last-request-order=" updateRequestOrder($event, { - parentCollectionIndexPath: node.data.value.parentCollectionID, + parentCollectionIndexPath: node.data.value.collectionID, requestIndex: null, }) " diff --git a/packages/hoppscotch-common/src/services/new-workspace/providers/personal.workspace.ts b/packages/hoppscotch-common/src/services/new-workspace/providers/personal.workspace.ts index 7d7f9d8d9..a19d2d496 100644 --- a/packages/hoppscotch-common/src/services/new-workspace/providers/personal.workspace.ts +++ b/packages/hoppscotch-common/src/services/new-workspace/providers/personal.workspace.ts @@ -10,7 +10,6 @@ import * as E from "fp-ts/Either" import { Ref, computed, - effect, effectScope, markRaw, ref, @@ -46,9 +45,7 @@ import { WorkspaceProvider } from "~/services/new-workspace/provider" import { RESTCollectionChildrenView, RESTCollectionLevelAuthHeadersView, - RESTCollectionViewCollection, RESTCollectionViewItem, - RESTCollectionViewRequest, RESTSearchResultsView, RootRESTCollectionView, } from "~/services/new-workspace/view" @@ -786,7 +783,7 @@ export class PersonalWorkspaceProviderService item.requests?.length > 1 ? id === item.requests.length - 1 : false, - parentCollectionID: collectionID, + collectionID, requestID: `${collectionID}/${id}`, request: req, }, diff --git a/packages/hoppscotch-common/src/services/new-workspace/view.ts b/packages/hoppscotch-common/src/services/new-workspace/view.ts index a45c6f75e..7b81c6bef 100644 --- a/packages/hoppscotch-common/src/services/new-workspace/view.ts +++ b/packages/hoppscotch-common/src/services/new-workspace/view.ts @@ -21,7 +21,6 @@ export type RESTCollectionViewRequest = { request: HoppRESTRequest isLastItem: boolean - parentCollectionID: string | null } export type RESTCollectionViewItem =