🐛 Fix Post operations on Orbit Node (#1699)

This commit is contained in:
MedAliMarz 2021-04-30 21:58:23 +02:00 committed by GitHub
parent 444fe64bc1
commit c9d0b17291
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View file

@ -413,22 +413,24 @@ export class Orbit implements INodeType {
const url = this.getNodeParameter('url', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
const body: IDataObject = {
type: "post",
url,
};
if (additionalFields.publishedAt) {
body.published_at = additionalFields.publishedAt as string;
body.occurred_at = additionalFields.publishedAt as string;
}
responseData = await orbitApiRequest.call(this, 'POST', `/${workspaceId}/members/${memberId}/posts`, body);
responseData = await orbitApiRequest.call(this, 'POST', `/${workspaceId}/members/${memberId}/activities/`, body);
responseData = responseData.data;
}
if (operation === 'getAll') {
const workspaceId = this.getNodeParameter('workspaceId', i) as string;
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
const filters = this.getNodeParameter('filters', i) as IDataObject;
let endpoint = `/${workspaceId}/posts`;
let endpoint = `/${workspaceId}/activities`;
qs.type = 'content';
if (filters.memberId) {
endpoint = `/${workspaceId}/members/${filters.memberId}/posts`;
endpoint = `/${workspaceId}/members/${filters.memberId}/activities`;
}
if (returnAll === true) {
responseData = await orbitApiRequestAllItems.call(this, 'data', 'GET', endpoint, {}, qs);
@ -443,7 +445,7 @@ export class Orbit implements INodeType {
const memberId = this.getNodeParameter('memberId', i) as string;
const postId = this.getNodeParameter('postId', i) as string;
responseData = await orbitApiRequest.call(this, 'DELETE', `/${workspaceId}/members/${memberId}/posts/${postId}`);
responseData = await orbitApiRequest.call(this, 'DELETE', `/${workspaceId}/members/${memberId}/activities/${postId}`);
responseData = { success: true };
}
}

View file

@ -114,7 +114,7 @@ export const postFields = [
default: {},
options: [
{
displayName: 'Published At',
displayName: 'Occurred At',
name: 'publishedAt',
type: 'dateTime',
default: '',