fix(Notion (Beta) Node): Fix create database page fails if relation param is empty/undefined (#5182)

* 🐛 fix create database page fails if relation param is empty/undefined

*  uuid validation

*  uuid error handling

Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
Marcus
2023-01-19 18:01:56 +01:00
committed by GitHub
parent 6e391755e4
commit 11da863a21
3 changed files with 45 additions and 16 deletions

View File

@@ -26,6 +26,7 @@ import {
notionApiRequest,
notionApiRequestAllItems,
simplifyObjects,
SortData,
validateJSON,
} from '../GenericFunctions';
@@ -457,7 +458,7 @@ export class NotionV2 implements INodeType {
if (propertiesValues.length !== 0) {
body.properties = Object.assign(
body.properties,
mapProperties(propertiesValues, timezone, 2) as IDataObject,
mapProperties.call(this, propertiesValues, timezone, 2) as IDataObject,
);
}
const blockValues = this.getNodeParameter('blockUi.blockValues', i, []) as IDataObject[];
@@ -536,8 +537,7 @@ export class NotionV2 implements INodeType {
delete body.filter;
}
if (sort) {
//@ts-expect-error
body.sorts = mapSorting(sort);
body.sorts = mapSorting(sort as SortData[]);
}
if (returnAll) {
responseData = await notionApiRequestAllItems.call(
@@ -590,7 +590,7 @@ export class NotionV2 implements INodeType {
properties: {},
};
if (properties.length !== 0) {
body.properties = mapProperties(properties, timezone, 2) as IDataObject;
body.properties = mapProperties.call(this, properties, timezone, 2) as IDataObject;
}
responseData = await notionApiRequest.call(this, 'PATCH', `/pages/${pageId}`, body);
if (simple) {