From 92d73a5be4a48dce57c866491b1c55466d20bf79 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 20 Oct 2020 09:38:11 -0400 Subject: [PATCH] set collection view id from response (#176) --- src/commands/create.command.ts | 6 ++++-- src/commands/edit.command.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/commands/create.command.ts b/src/commands/create.command.ts index 07000d4..cd5f221 100644 --- a/src/commands/create.command.ts +++ b/src/commands/create.command.ts @@ -154,8 +154,10 @@ export class CreateCommand { request.name = (await this.cryptoService.encrypt(req.name, orgKey)).encryptedString; request.externalId = req.externalId; request.groups = groups; - await this.apiService.postCollection(req.organizationId, request); - const res = new OrganizationCollectionResponse(Collection.toView(req), groups); + const response = await this.apiService.postCollection(req.organizationId, request); + const view = Collection.toView(req); + view.id = response.id; + const res = new OrganizationCollectionResponse(view, groups); return Response.success(res); } catch (e) { return Response.error(e); diff --git a/src/commands/edit.command.ts b/src/commands/edit.command.ts index 68a4e05..ae3b37a 100644 --- a/src/commands/edit.command.ts +++ b/src/commands/edit.command.ts @@ -152,8 +152,10 @@ export class EditCommand { request.name = (await this.cryptoService.encrypt(req.name, orgKey)).encryptedString; request.externalId = req.externalId; request.groups = groups; - await this.apiService.putCollection(req.organizationId, id, request); - const res = new OrganizationCollectionResponse(Collection.toView(req), groups); + const response = await this.apiService.putCollection(req.organizationId, id, request); + const view = Collection.toView(req); + view.id = response.id; + const res = new OrganizationCollectionResponse(view, groups); return Response.success(res); } catch (e) { return Response.error(e);