mirror of
https://github.com/dadosfera/maestro.git
synced 2026-08-31 19:58:21 +00:00
REFACTOR: nimbus URL
This commit is contained in:
@@ -1,39 +1,31 @@
|
||||
import axios from 'axios';
|
||||
|
||||
class CatalogService {
|
||||
async catalogAll(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
_getNimbusUrl(body) {
|
||||
const customer = body.info.customer.toLowerCase();
|
||||
|
||||
if (process.env.ENV === 'prd') {
|
||||
return `https://nimbus-${customer}.dadosfera.ai`;
|
||||
}
|
||||
|
||||
return `https://nimbus-${customer}.${process.env.ENV}.dadosfera.ai`;
|
||||
}
|
||||
|
||||
async catalogAll(body) {
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(`${nimbusUrl}/api/catalog/all/`);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
async dataAppsAll(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data_apps/`);
|
||||
return data;
|
||||
}
|
||||
|
||||
async dataAppsOne(id, body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(
|
||||
`${nimbusUrl}/api/catalog/data_apps/${id}/`,
|
||||
);
|
||||
@@ -42,12 +34,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getAllDashboardMetabase(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(
|
||||
`${nimbusUrl}/api/catalog/dashboard-metabase/`,
|
||||
);
|
||||
@@ -55,12 +42,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getOneDashboardMetabase(id, body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(
|
||||
`${nimbusUrl}/api/catalog/dashboard-metabase/${id}`,
|
||||
);
|
||||
@@ -74,12 +56,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getAllTableMetadata(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(
|
||||
`${nimbusUrl}/api/catalog/table-metadata/`,
|
||||
);
|
||||
@@ -87,12 +64,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getOneTableMetadata(body, params) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(
|
||||
`${nimbusUrl}/api/catalog/table-metadata/`,
|
||||
{ params: params },
|
||||
@@ -101,12 +73,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async deleteOneTableMetadata(id, body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.delete(
|
||||
`${nimbusUrl}/api/catalog/table-metadata/${id}`,
|
||||
);
|
||||
@@ -114,12 +81,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getOneColumnMetadata(body, params) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(
|
||||
`${nimbusUrl}/api/catalog/column-metadata/`,
|
||||
{ params: params },
|
||||
@@ -128,12 +90,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async deleteOneColumnMetadata(id, body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.delete(
|
||||
`${nimbusUrl}/api/catalog/column-metadata/${id}/`,
|
||||
);
|
||||
@@ -141,12 +98,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getOneDataPreview(body, params) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data-preview/`, {
|
||||
params: params,
|
||||
});
|
||||
@@ -154,23 +106,13 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getDataStatus(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data-status/`);
|
||||
return data;
|
||||
}
|
||||
|
||||
async createDataStatus(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.post(
|
||||
`${nimbusUrl}/api/catalog/data-status/`,
|
||||
body,
|
||||
@@ -179,12 +121,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getDataDescription(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(
|
||||
`${nimbusUrl}/api/catalog/data-description/`,
|
||||
);
|
||||
@@ -192,12 +129,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async createDataDescription(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.post(
|
||||
`${nimbusUrl}/api/catalog/data-description/`,
|
||||
body,
|
||||
@@ -206,23 +138,13 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getDataDocs(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data-docs/`);
|
||||
return data;
|
||||
}
|
||||
|
||||
async createDataDocs(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.post(
|
||||
`${nimbusUrl}/api/catalog/data-docs/`,
|
||||
body,
|
||||
@@ -231,23 +153,13 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getDataRating(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data-rating/`);
|
||||
return data;
|
||||
}
|
||||
|
||||
async createDataRating(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.post(
|
||||
`${nimbusUrl}/api/catalog/data-rating/`,
|
||||
body,
|
||||
@@ -256,12 +168,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getSummaryRating(id, body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(
|
||||
`${nimbusUrl}/api/catalog/summary-rating/${id}`,
|
||||
);
|
||||
@@ -269,23 +176,13 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getDataComment(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data-comment/`);
|
||||
return data;
|
||||
}
|
||||
|
||||
async createDataComment(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.post(
|
||||
`${nimbusUrl}/api/catalog/data-comment/`,
|
||||
body,
|
||||
@@ -294,12 +191,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getDataReview(body, params) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data-review/`, {
|
||||
params: params,
|
||||
});
|
||||
@@ -307,34 +199,19 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async createTags(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.post(`${nimbusUrl}/api/catalog/tags/`, body);
|
||||
return data;
|
||||
}
|
||||
|
||||
async findAllTags(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(`${nimbusUrl}/api/catalog/tags/`, body);
|
||||
return data;
|
||||
}
|
||||
|
||||
async findAllTableTags(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(
|
||||
`${nimbusUrl}/api/catalog/table-tags/`,
|
||||
body,
|
||||
@@ -343,23 +220,13 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async deleteTags(id, body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.delete(`${nimbusUrl}/api/catalog/tags/${id}`);
|
||||
return data;
|
||||
}
|
||||
|
||||
async createTableTags(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.post(
|
||||
`${nimbusUrl}/api/catalog/table-tags/`,
|
||||
body,
|
||||
@@ -368,12 +235,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async deleteTableTags(id, body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.delete(
|
||||
`${nimbusUrl}/api/catalog/table-tags/${id}`,
|
||||
);
|
||||
@@ -381,12 +243,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async getTableRules(body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.get(
|
||||
`${nimbusUrl}/api/catalog/table-rules/`,
|
||||
body,
|
||||
@@ -395,12 +252,7 @@ class CatalogService {
|
||||
}
|
||||
|
||||
async deleteTableRules(id, body) {
|
||||
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
|
||||
if (process.env.ENV !== 'prd') {
|
||||
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
|
||||
process.env.ENV
|
||||
}.dadosfera.ai`;
|
||||
}
|
||||
const nimbusUrl = this._getNimbusUrl(body);
|
||||
const { data } = await axios.delete(
|
||||
`${nimbusUrl}/api/catalog/table-rules/${id}`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user