From: Stephen Smith Date: Fri, 12 Apr 2024 00:29:04 +0000 (-0400) Subject: 21691: Add types to replace files methods for differing parameter/result types X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/3de055c028a3e761de60d955f450b06ccee21380 21691: Add types to replace files methods for differing parameter/result types Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- diff --git a/services/workbench2/src/services/collection-service/collection-service.ts b/services/workbench2/src/services/collection-service/collection-service.ts index e50e5ed350..12d31d1678 100644 --- a/services/workbench2/src/services/collection-service/collection-service.ts +++ b/services/workbench2/src/services/collection-service/collection-service.ts @@ -3,7 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0 import { CollectionResource, defaultCollectionSelectedFields } from "models/collection"; -import { AxiosInstance } from "axios"; +import { AxiosInstance, AxiosResponse } from "axios"; import { CollectionFile, CollectionDirectory } from "models/collection-file"; import { WebDAV } from "common/webdav"; import { AuthService } from "../auth-service/auth-service"; @@ -20,6 +20,11 @@ type CollectionPartialUpdateOrCreate = | (Partial & Pick) | (Partial & Pick); +type ReplaceFilesPayload = { + collection: Partial; + replace_files: {[key: string]: string}; +} + export const emptyCollectionPdh = "d41d8cd98f00b204e9800998ecf8427e+0"; export const SOURCE_DESTINATION_EQUAL_ERROR_MESSAGE = "Source and destination cannot be the same"; @@ -78,7 +83,7 @@ export class CollectionService extends TrashableResourceService(`/${this.resourceType}/${data.uuid}`, payload), + this.serverApi.put>(`/${this.resourceType}/${data.uuid}`, payload), this.actions, true, // mapKeys showErrors ); } else { return CommonService.defaultResponse( - this.serverApi.post(`/${this.resourceType}`, payload), + this.serverApi.post>(`/${this.resourceType}`, payload), this.actions, true, // mapKeys showErrors