From 39796c9038d21087d48e91c0dc36a2b07ce6e464 Mon Sep 17 00:00:00 2001 From: Lench Volodymyr Date: Thu, 21 Jan 2021 15:12:25 +0200 Subject: [PATCH] fix re parition key when there is no property for it --- forward_engineering/api.js | 4 +++- reverse_engineering/api.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/forward_engineering/api.js b/forward_engineering/api.js index a465dbb..c562e88 100644 --- a/forward_engineering/api.js +++ b/forward_engineering/api.js @@ -61,7 +61,9 @@ const updateSample = (sample, containerData, entityData) => { }; const getPartitionKey = (_) => (containerData) => { - return _.get(containerData, '[0].partitionKey[0].name'); + const partitionKey = _.get(containerData, '[0].partitionKey[0].name', '').trim().replace(/\/$/, ''); + + return partitionKey; }; const add = (key, items, mapper) => (script) => { diff --git a/reverse_engineering/api.js b/reverse_engineering/api.js index e1d7d57..7af78d3 100644 --- a/reverse_engineering/api.js +++ b/reverse_engineering/api.js @@ -206,7 +206,7 @@ module.exports = { indexes: [], views: [], validation: createSchemaByPartitionKeyPath(partitionKey, filteredDocuments), - docType: bucketName, + docType: 'type', bucketInfo };