Skip to content

Commit

Permalink
fix(Supabase Node): Reset query parameters in get many operation (#11630
Browse files Browse the repository at this point in the history
)
  • Loading branch information
michael-radency authored Nov 8, 2024
1 parent 38fefff commit 7458229
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/nodes-base/nodes/Supabase/Supabase.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,16 @@ export class Supabase implements INodeType {
const items = this.getInputData();
const returnData: INodeExecutionData[] = [];
const length = items.length;
const qs: IDataObject = {};
let qs: IDataObject = {};
const resource = this.getNodeParameter('resource', 0);
const operation = this.getNodeParameter('operation', 0);

if (resource === 'row') {
const tableId = this.getNodeParameter('tableId', 0) as string;

if (operation === 'create') {
const records: IDataObject[] = [];
const tableId = this.getNodeParameter('tableId', 0) as string;

for (let i = 0; i < length; i++) {
const record: IDataObject = {};
const dataToSend = this.getNodeParameter('dataToSend', 0) as
Expand Down Expand Up @@ -185,7 +187,6 @@ export class Supabase implements INodeType {
}

if (operation === 'delete') {
const tableId = this.getNodeParameter('tableId', 0) as string;
const filterType = this.getNodeParameter('filterType', 0) as string;
for (let i = 0; i < length; i++) {
let endpoint = `/${tableId}`;
Expand Down Expand Up @@ -241,7 +242,6 @@ export class Supabase implements INodeType {
}

if (operation === 'get') {
const tableId = this.getNodeParameter('tableId', 0) as string;
const endpoint = `/${tableId}`;

for (let i = 0; i < length; i++) {
Expand Down Expand Up @@ -281,11 +281,13 @@ export class Supabase implements INodeType {
}

if (operation === 'getAll') {
const tableId = this.getNodeParameter('tableId', 0) as string;
const returnAll = this.getNodeParameter('returnAll', 0);
const filterType = this.getNodeParameter('filterType', 0) as string;

let endpoint = `/${tableId}`;
for (let i = 0; i < length; i++) {
qs = {}; // reset qs

if (filterType === 'manual') {
const matchType = this.getNodeParameter('matchType', 0) as string;
const keys = this.getNodeParameter('filters.conditions', i, []) as IDataObject[];
Expand Down Expand Up @@ -342,7 +344,6 @@ export class Supabase implements INodeType {
}

if (operation === 'update') {
const tableId = this.getNodeParameter('tableId', 0) as string;
const filterType = this.getNodeParameter('filterType', 0) as string;
let endpoint = `/${tableId}`;
for (let i = 0; i < length; i++) {
Expand Down

0 comments on commit 7458229

Please sign in to comment.