mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-14 12:38:39 +00:00
fix TJDB query with subpath setup
This commit is contained in:
parent
2e6f4510dd
commit
8a9cd790c1
1 changed files with 5 additions and 4 deletions
|
|
@ -4,6 +4,7 @@ import { QueryService, QueryResult } from '@tooljet/plugins/dist/packages/common
|
|||
import { TooljetDbService } from './tooljet_db.service';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { PostgrestProxyService } from './postgrest_proxy.service';
|
||||
import { maybeSetSubPath } from 'src/helpers/utils.helper';
|
||||
|
||||
@Injectable()
|
||||
export class TooljetDbOperationsService implements QueryService {
|
||||
|
|
@ -74,7 +75,7 @@ export class TooljetDbOperationsService implements QueryService {
|
|||
!isEmpty(offset) && query.push(`offset=${offset}`);
|
||||
}
|
||||
const headers = { 'data-query-id': queryOptions.id, 'tj-workspace-id': queryOptions.organization_id };
|
||||
const url = `/api/tooljet-db/proxy/${tableId}` + `?${query}`;
|
||||
const url = maybeSetSubPath(`/api/tooljet-db/proxy/${tableId}` + `?${query}`);
|
||||
|
||||
return await this.proxyPostgrest(url, 'GET', headers);
|
||||
}
|
||||
|
|
@ -87,7 +88,7 @@ export class TooljetDbOperationsService implements QueryService {
|
|||
|
||||
const headers = { 'data-query-id': queryOptions.id, 'tj-workspace-id': queryOptions.organization_id };
|
||||
|
||||
const url = `/api/tooljet-db/proxy/${queryOptions.table_id}`;
|
||||
const url = maybeSetSubPath(`/api/tooljet-db/proxy/${queryOptions.table_id}`);
|
||||
return await this.proxyPostgrest(url, 'POST', headers, columns);
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +113,7 @@ export class TooljetDbOperationsService implements QueryService {
|
|||
!isEmpty(whereQuery) && query.push(whereQuery);
|
||||
|
||||
const headers = { 'data-query-id': queryOptions.id, 'tj-workspace-id': queryOptions.organization_id };
|
||||
const url = `/api/tooljet-db/proxy/${tableId}?` + query.join('&') + '&order=id';
|
||||
const url = maybeSetSubPath(`/api/tooljet-db/proxy/${tableId}?` + query.join('&') + '&order=id');
|
||||
return await this.proxyPostgrest(url, 'PATCH', headers, body);
|
||||
}
|
||||
|
||||
|
|
@ -149,7 +150,7 @@ export class TooljetDbOperationsService implements QueryService {
|
|||
limit && limit !== '' && query.push(`limit=${limit}&order=id`);
|
||||
|
||||
const headers = { 'data-query-id': queryOptions.id, 'tj-workspace-id': queryOptions.organization_id };
|
||||
const url = `/api/tooljet-db/proxy/${tableId}?` + query.join('&');
|
||||
const url = maybeSetSubPath(`/api/tooljet-db/proxy/${tableId}?` + query.join('&'));
|
||||
return await this.proxyPostgrest(url, 'DELETE', headers);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue