Skip to content

Commit

Permalink
fix(Notion (Beta) Node): Fix create database page with multiple relat…
Browse files Browse the repository at this point in the history
…ion ids not working (#5260)

🐛 fix
  • Loading branch information
maspio authored Jan 27, 2023
1 parent 99e35f1 commit 8ce85e3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/nodes-base/nodes/Notion/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import moment from 'moment-timezone';
import { validate as uuidValidate } from 'uuid';

function uuidValidateWithoutDashes(this: IExecuteFunctions, value: string) {
if (!value || typeof value !== 'string') return false;
if (uuidValidate(value)) return true;
if (value.length == 32) {
//prettier-ignore
Expand Down Expand Up @@ -313,12 +312,16 @@ function getPropertyKeyValue(
result = {
type: 'relation',
relation: value.relationValue
.filter((rv: string) => {
return uuidValidateWithoutDashes.call(this, rv);
.filter((relation: any) => {
return relation && typeof relation === 'string';
})
.reduce((acc: [], cur: any) => {
return acc.concat(cur.split(',').map((relation: string) => ({ id: relation.trim() })));
}, []),
return acc.concat(cur.split(',').map((relation: string) => relation.trim()));
}, [])
.filter((relation: string) => {
return uuidValidateWithoutDashes.call(this, relation);
})
.map((relation: string) => ({ id: relation })),
};
break;
case 'multi_select':
Expand Down

0 comments on commit 8ce85e3

Please sign in to comment.