mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-11 20:19:09 +00:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65ab16236f | ||
|
|
b4cc8151d7 | ||
|
|
a5d78a97ae | ||
|
|
2b33c22149 | ||
|
|
e32787baff | ||
|
|
f449d8ebd9 | ||
|
|
02627d023a | ||
|
|
cf94c73648 | ||
|
|
6b3241281b | ||
|
|
fe1caa003e | ||
|
|
e980c58507 |
@@ -113,6 +113,8 @@ spec:
|
|||||||
value: {{ .Values.maestro.platform_api_url }}
|
value: {{ .Values.maestro.platform_api_url }}
|
||||||
- name: STORAGE_EXPLORER_API_URL
|
- name: STORAGE_EXPLORER_API_URL
|
||||||
value: {{ .Values.maestro.storage_explorer_api_url | quote }}
|
value: {{ .Values.maestro.storage_explorer_api_url | quote }}
|
||||||
|
- name: FIREBASE_BASE_URL
|
||||||
|
value: {{ .Values.maestro.firebase_base_url }}
|
||||||
- name: JWT_PRIVATE_KEY
|
- name: JWT_PRIVATE_KEY
|
||||||
valueFrom:
|
valueFrom:
|
||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ maestro:
|
|||||||
redis_database: "1"
|
redis_database: "1"
|
||||||
platform_api_url: https://xs2hkhq07k.execute-api.us-east-1.amazonaws.com
|
platform_api_url: https://xs2hkhq07k.execute-api.us-east-1.amazonaws.com
|
||||||
storage_explorer_api_url: "http://storage-explorer-{customer}.data-apps.svc.cluster.local:8000/api"
|
storage_explorer_api_url: "http://storage-explorer-{customer}.data-apps.svc.cluster.local:8000/api"
|
||||||
|
firebase_base_url: https://feature-flag-25bf6-default-rtdb.firebaseio.com/stg
|
||||||
|
|
||||||
hostname: maestro.stg.dadosfera.ai
|
hostname: maestro.stg.dadosfera.ai
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ maestro:
|
|||||||
redis_database: "0"
|
redis_database: "0"
|
||||||
redis_tls: "true"
|
redis_tls: "true"
|
||||||
cookie_secret: "13cc5e136d3074bcc05bec8697092ec1f5f376bf"
|
cookie_secret: "13cc5e136d3074bcc05bec8697092ec1f5f376bf"
|
||||||
|
firebase_base_url: https://feature-flag-25bf6-default-rtdb.firebaseio.com/prd
|
||||||
autoscaling:
|
autoscaling:
|
||||||
enabled: false
|
enabled: false
|
||||||
minReplicas: 1
|
minReplicas: 1
|
||||||
|
|||||||
+123
@@ -3541,6 +3541,64 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/pipelinesV2/{id}/data-assets": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "PipelinesController_findAllDataAssetByPipeline",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "dadosfera-lang",
|
||||||
|
"in": "header",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"enum": [
|
||||||
|
"pt-br",
|
||||||
|
"en-us"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"required": true,
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "object",
|
||||||
|
"required": true,
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"PipelinesV2"
|
||||||
|
],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"access-token": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/pipelinesV2/{pipelineId}/inputs/{id}": {
|
"/pipelinesV2/{pipelineId}/inputs/{id}": {
|
||||||
"patch": {
|
"patch": {
|
||||||
"operationId": "PipelinesController_updatePipelineInput",
|
"operationId": "PipelinesController_updatePipelineInput",
|
||||||
@@ -5431,6 +5489,48 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/catalog/schemas": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "CatalogController_findSchemas",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "dadosfera-lang",
|
||||||
|
"in": "header",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"enum": [
|
||||||
|
"pt-br",
|
||||||
|
"en-us"
|
||||||
|
],
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"Catalog"
|
||||||
|
],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"access-token": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"access-token": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/catalog/data-asset/{id}": {
|
"/catalog/data-asset/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"operationId": "CatalogController_getDataAsset",
|
"operationId": "CatalogController_getDataAsset",
|
||||||
@@ -8496,6 +8596,29 @@
|
|||||||
"Health"
|
"Health"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/release_note": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "ReleaseNoteController_getLatestReleaseNote",
|
||||||
|
"parameters": [],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"access-token": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"info": {
|
"info": {
|
||||||
|
|||||||
Generated
+5
-4
@@ -17,7 +17,7 @@
|
|||||||
"@aws-sdk/signature-v4": "^3.370.0",
|
"@aws-sdk/signature-v4": "^3.370.0",
|
||||||
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
||||||
"@dadosfera/protospack": "2.5.3",
|
"@dadosfera/protospack": "2.5.3",
|
||||||
"@dadosfera/protospack-v2": "^3.40.0-beta.5",
|
"@dadosfera/protospack-v2": "3.40.0-beta.8",
|
||||||
"@grpc/grpc-js": "^1.9.3",
|
"@grpc/grpc-js": "^1.9.3",
|
||||||
"@grpc/proto-loader": "^0.7.9",
|
"@grpc/proto-loader": "^0.7.9",
|
||||||
"@nestjs/cli": "^9.5.0",
|
"@nestjs/cli": "^9.5.0",
|
||||||
@@ -1745,9 +1745,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@dadosfera/protospack-v2": {
|
"node_modules/@dadosfera/protospack-v2": {
|
||||||
"version": "3.40.0-beta.5",
|
"version": "3.40.0-beta.8",
|
||||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.40.0-beta.5.tgz",
|
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.40.0-beta.8.tgz",
|
||||||
"integrity": "sha512-iocKv/XXp2jKAasO5ONgm31cKfLgNsU4pEKZMr6YnR7nQaH11WcW7rnuagNxWoik++wLUqbYyf0bZWRDzMlCPA==",
|
"integrity": "sha512-JE5qMjqB3UOM+tCUxB1EwYLQW0PecsaQIa1KDpKEaG3lrzG/H13z8iJi3WH/DuVav2EI94i9VcJWJ1Y0F7ribw==",
|
||||||
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@grpc/grpc-js": "^1.9.3",
|
"@grpc/grpc-js": "^1.9.3",
|
||||||
"rxjs": "^7.5.5"
|
"rxjs": "^7.5.5"
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@
|
|||||||
"@aws-sdk/signature-v4": "^3.370.0",
|
"@aws-sdk/signature-v4": "^3.370.0",
|
||||||
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
||||||
"@dadosfera/protospack": "2.5.3",
|
"@dadosfera/protospack": "2.5.3",
|
||||||
"@dadosfera/protospack-v2": "^3.40.0-beta.5",
|
"@dadosfera/protospack-v2": "3.40.0-beta.8",
|
||||||
"@grpc/grpc-js": "^1.9.3",
|
"@grpc/grpc-js": "^1.9.3",
|
||||||
"@grpc/proto-loader": "^0.7.9",
|
"@grpc/proto-loader": "^0.7.9",
|
||||||
"@nestjs/cli": "^9.5.0",
|
"@nestjs/cli": "^9.5.0",
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ import { ShareMetadataModule } from './modules/share-metadata/share-metadata.mod
|
|||||||
import { ApiKeyModule } from './modules/api-key/api-key.module';
|
import { ApiKeyModule } from './modules/api-key/api-key.module';
|
||||||
import { PlatformApiModule } from './modules/platform-api/platform-api.module';
|
import { PlatformApiModule } from './modules/platform-api/platform-api.module';
|
||||||
import { StorageExplorerModule } from './modules/storage-explorer/storage-explorer.module';
|
import { StorageExplorerModule } from './modules/storage-explorer/storage-explorer.module';
|
||||||
|
import { ReleaseNoteModule } from './modules/release_note/release_note.module';
|
||||||
|
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [
|
providers: [
|
||||||
@@ -79,6 +81,7 @@ import { StorageExplorerModule } from './modules/storage-explorer/storage-explor
|
|||||||
StorageExplorerModule,
|
StorageExplorerModule,
|
||||||
//Always leave HealthModule last, so it is on the bottom of swagger
|
//Always leave HealthModule last, so it is on the bottom of swagger
|
||||||
HealthModule,
|
HealthModule,
|
||||||
|
ReleaseNoteModule,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ export class AuthenticationGuard
|
|||||||
user_id: accessTokenPayload.user_id,
|
user_id: accessTokenPayload.user_id,
|
||||||
username: accessTokenPayload.username,
|
username: accessTokenPayload.username,
|
||||||
permissions: accessTokenPayload.permissions,
|
permissions: accessTokenPayload.permissions,
|
||||||
|
roles: accessTokenPayload.roles,
|
||||||
customer_id: accessTokenPayload.customer_id,
|
customer_id: accessTokenPayload.customer_id,
|
||||||
customer_name: accessTokenPayload.customer_name,
|
customer_name: accessTokenPayload.customer_name,
|
||||||
customer_tier: accessTokenPayload.customer_tier,
|
customer_tier: accessTokenPayload.customer_tier,
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export function extractUserFrom(aRawJwt: string) {
|
|||||||
user_id: payload.user_id,
|
user_id: payload.user_id,
|
||||||
username: payload.username,
|
username: payload.username,
|
||||||
permissions: payload.permissions,
|
permissions: payload.permissions,
|
||||||
|
roles: payload.roles,
|
||||||
customer_id: payload.customer_id,
|
customer_id: payload.customer_id,
|
||||||
customer_name: payload.customer_name,
|
customer_name: payload.customer_name,
|
||||||
customer_tier: payload.customer_tier,
|
customer_tier: payload.customer_tier,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export interface RequestUser {
|
|||||||
customer_tier: string;
|
customer_tier: string;
|
||||||
access_token: string;
|
access_token: string;
|
||||||
customer_modules: string[];
|
customer_modules: string[];
|
||||||
|
roles: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const User: (options?: { required?: boolean }) => ParameterDecorator =
|
export const User: (options?: { required?: boolean }) => ParameterDecorator =
|
||||||
|
|||||||
@@ -241,6 +241,34 @@ export class CatalogController {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('schemas')
|
||||||
|
@RequireSomePermission(
|
||||||
|
PERMISSIONS_GROUPS.CATALOG.permissions.GET,
|
||||||
|
PERMISSIONS_GROUPS.CATALOG.permissions.DATA_MANAGER,
|
||||||
|
)
|
||||||
|
async findSchemas(@User() user: RequestUser) {
|
||||||
|
const { username, user_id, customer_id, customer_name } = user;
|
||||||
|
this.logger.info(`/catalog - ON FIND SCHEMAS ROUTE`, {
|
||||||
|
username,
|
||||||
|
customer_name,
|
||||||
|
});
|
||||||
|
|
||||||
|
const metadata = PackTheMetadata({
|
||||||
|
username,
|
||||||
|
user_id,
|
||||||
|
customer_id,
|
||||||
|
customer_name,
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await this.catalogService.findSchemas(metadata);
|
||||||
|
return res;
|
||||||
|
} catch (error) {
|
||||||
|
throw new HttpException(error.message, HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Get('data-asset/:id')
|
@Get('data-asset/:id')
|
||||||
@RequireSomePermission(
|
@RequireSomePermission(
|
||||||
PERMISSIONS_GROUPS.CATALOG.permissions.GET,
|
PERMISSIONS_GROUPS.CATALOG.permissions.GET,
|
||||||
|
|||||||
@@ -214,15 +214,6 @@ class CatalogService implements OnModuleInit {
|
|||||||
|
|
||||||
this.logger.debug('Extracted filters:', { filters });
|
this.logger.debug('Extracted filters:', { filters });
|
||||||
|
|
||||||
console.log('MAESTRO VAI CHAMAR PI-FACTORY COM (ANTES AJUSTE):', {
|
|
||||||
search,
|
|
||||||
page,
|
|
||||||
size,
|
|
||||||
sort_by,
|
|
||||||
order,
|
|
||||||
filters,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
filters.manually !== undefined &&
|
filters.manually !== undefined &&
|
||||||
filters.manually !== null &&
|
filters.manually !== null &&
|
||||||
@@ -233,15 +224,6 @@ class CatalogService implements OnModuleInit {
|
|||||||
delete filters.manually;
|
delete filters.manually;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('MAESTRO VAI CHAMAR PI-FACTORY COM (DEPOIS AJUSTE):', {
|
|
||||||
search,
|
|
||||||
page,
|
|
||||||
size,
|
|
||||||
sort_by,
|
|
||||||
order,
|
|
||||||
filters,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (filters.owner) {
|
if (filters.owner) {
|
||||||
const { users: customer_users } =
|
const { users: customer_users } =
|
||||||
await this.userService.findAllUsersByCustomerId(customer_id);
|
await this.userService.findAllUsersByCustomerId(customer_id);
|
||||||
@@ -517,6 +499,22 @@ class CatalogService implements OnModuleInit {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async findSchemas(metadata: Metadata) {
|
||||||
|
this.logger.info('CatalogService - findSchemas');
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await lastValueFrom(
|
||||||
|
this.catalogReadService.GetSchemas({}, metadata),
|
||||||
|
);
|
||||||
|
|
||||||
|
return response;
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
this.logger.error('Error fetching schemas:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getAssetsUsersAndRoles(data_assets: Array<any>, customer_id: string) {
|
async getAssetsUsersAndRoles(data_assets: Array<any>, customer_id: string) {
|
||||||
const { users: customer_users } =
|
const { users: customer_users } =
|
||||||
await this.userService.findAllUsersByCustomerId(customer_id);
|
await this.userService.findAllUsersByCustomerId(customer_id);
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ export class ShareService implements OnModuleInit {
|
|||||||
user_id: accessTokenPayload.user_id,
|
user_id: accessTokenPayload.user_id,
|
||||||
username: accessTokenPayload.username,
|
username: accessTokenPayload.username,
|
||||||
permissions: accessTokenPayload.permissions,
|
permissions: accessTokenPayload.permissions,
|
||||||
|
roles: accessTokenPayload.roles,
|
||||||
customer_id: accessTokenPayload.customer_id,
|
customer_id: accessTokenPayload.customer_id,
|
||||||
customer_name: accessTokenPayload.customer_name,
|
customer_name: accessTokenPayload.customer_name,
|
||||||
customer_tier: accessTokenPayload.customer_tier,
|
customer_tier: accessTokenPayload.customer_tier,
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ export class PipelinesController {
|
|||||||
@Get(':id/status')
|
@Get(':id/status')
|
||||||
@RequireSomePermission(PERMISSIONS_GROUPS.IMPORT_FILES.permissions.VIEW, PERMISSIONS_GROUPS.PIPELINE.permissions.GET)
|
@RequireSomePermission(PERMISSIONS_GROUPS.IMPORT_FILES.permissions.VIEW, PERMISSIONS_GROUPS.PIPELINE.permissions.GET)
|
||||||
async getPipelineStatus(@Body() body, @Param('id') id: string) {
|
async getPipelineStatus(@Body() body, @Param('id') id: string) {
|
||||||
|
|
||||||
body.id = id;
|
body.id = id;
|
||||||
|
|
||||||
this.logger.info(`/pipeline/${id} - ON GET PIPELINE STATUS ROUTE`, {
|
this.logger.info(`/pipeline/${id} - ON GET PIPELINE STATUS ROUTE`, {
|
||||||
@@ -247,6 +248,31 @@ export class PipelinesController {
|
|||||||
return pipelineRes;
|
return pipelineRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get("/:id/data-assets")
|
||||||
|
@RequireSomePermission(
|
||||||
|
PERMISSIONS_GROUPS.PIPELINE.permissions.GET,
|
||||||
|
PERMISSIONS_GROUPS.CATALOG.permissions.DATA_MANAGER,
|
||||||
|
PERMISSIONS_GROUPS.CATALOG.permissions.GET
|
||||||
|
)
|
||||||
|
async findAllDataAssetByPipeline(
|
||||||
|
@Language() language: LanguageEnum,
|
||||||
|
@Param('id') id: string,
|
||||||
|
@User() user: RequestUser,
|
||||||
|
@Query('object') object: string
|
||||||
|
) {
|
||||||
|
const payload = {
|
||||||
|
pipeline: id,
|
||||||
|
object: object,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.logger.info(`GET pipelinesV2/:id/data-assets` + JSON.stringify(payload));
|
||||||
|
|
||||||
|
const result =
|
||||||
|
await this.pipelinesClientService.findAllDataAssetByPipeline(payload, user);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Patch('/:id')
|
@Patch('/:id')
|
||||||
@RequireSomePermission(PERMISSIONS_GROUPS.PIPELINE.permissions.UPDATE)
|
@RequireSomePermission(PERMISSIONS_GROUPS.PIPELINE.permissions.UPDATE)
|
||||||
async update(
|
async update(
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { TransformationsModule } from '../transformations/transformations.module
|
|||||||
import { PlatformApiModule } from '../platform-api/platform-api.module';
|
import { PlatformApiModule } from '../platform-api/platform-api.module';
|
||||||
import { NimbusServicesModule } from 'src/services/nimbus/nimbus.module';
|
import { NimbusServicesModule } from 'src/services/nimbus/nimbus.module';
|
||||||
import { NimbusService } from 'src/services/nimbus/nimbus.service';
|
import { NimbusService } from 'src/services/nimbus/nimbus.service';
|
||||||
|
import { CatalogModule } from '../catalog/catalog.module';
|
||||||
|
|
||||||
const client = new PipelinesClientConfiguration();
|
const client = new PipelinesClientConfiguration();
|
||||||
|
|
||||||
@@ -25,7 +26,8 @@ const client = new PipelinesClientConfiguration();
|
|||||||
InputsModule,
|
InputsModule,
|
||||||
TransformationsModule,
|
TransformationsModule,
|
||||||
PlatformApiModule,
|
PlatformApiModule,
|
||||||
NimbusServicesModule
|
NimbusServicesModule,
|
||||||
|
CatalogModule
|
||||||
],
|
],
|
||||||
controllers: [PipelinesController],
|
controllers: [PipelinesController],
|
||||||
providers: [PipelinesService, DadosferaLogger, NimbusService],
|
providers: [PipelinesService, DadosferaLogger, NimbusService],
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ import { Info } from '@dadosfera/protospack-v2/dist/lib/Input/interfaces/entitie
|
|||||||
import { TableUpdate } from '@dadosfera/protospack-v2/dist/lib/Input/interfaces/messages';
|
import { TableUpdate } from '@dadosfera/protospack-v2/dist/lib/Input/interfaces/messages';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import { NimbusService } from 'src/services/nimbus/nimbus.service';
|
import { NimbusService } from 'src/services/nimbus/nimbus.service';
|
||||||
|
import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum';
|
||||||
|
import { PackTheMetadata } from 'src/utils/PackTheMetadata';
|
||||||
|
import { IDataAsset } from '../catalog/dtos';
|
||||||
|
import { CatalogService } from '../catalog/catalog.service';
|
||||||
|
|
||||||
type RollbackPromise = () => Promise<any>;
|
type RollbackPromise = () => Promise<any>;
|
||||||
|
|
||||||
@@ -48,7 +52,8 @@ export class PipelinesService implements OnModuleInit {
|
|||||||
private readonly inputsService: InputsService,
|
private readonly inputsService: InputsService,
|
||||||
private readonly transformationsService: TransformationsService,
|
private readonly transformationsService: TransformationsService,
|
||||||
private readonly platformAPI: PlatformApiService,
|
private readonly platformAPI: PlatformApiService,
|
||||||
private readonly nimbusService: NimbusService
|
private readonly nimbusService: NimbusService,
|
||||||
|
private readonly catalogService: CatalogService
|
||||||
) {
|
) {
|
||||||
this.logger = dadosferaLogger.logger;
|
this.logger = dadosferaLogger.logger;
|
||||||
}
|
}
|
||||||
@@ -577,4 +582,45 @@ export class PipelinesService implements OnModuleInit {
|
|||||||
this.logger.info('Platform api response: ' + JSON.stringify(response));
|
this.logger.info('Platform api response: ' + JSON.stringify(response));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async findAllDataAssetByPipeline(data: {
|
||||||
|
pipeline: string,
|
||||||
|
object?: string
|
||||||
|
}, user: RequestUser) {
|
||||||
|
const metadata = PackTheMetadata(user);
|
||||||
|
|
||||||
|
const isDataAdmin = user.permissions.includes(
|
||||||
|
PERMISSIONS_GROUPS.CATALOG.permissions.DATA_MANAGER.seqid,
|
||||||
|
);
|
||||||
|
|
||||||
|
let has_permission = false;
|
||||||
|
|
||||||
|
const {
|
||||||
|
data_assets: resultString
|
||||||
|
} = await lastValueFrom(
|
||||||
|
this.pipelineReadService.FindAllDataAssetByPipeline(data, metadata)
|
||||||
|
);
|
||||||
|
|
||||||
|
const result = JSON.parse(resultString) as any;
|
||||||
|
const data_assets: IDataAsset[] = []
|
||||||
|
result.forEach(data_asset => {
|
||||||
|
if (data_asset?.owner === user.username) has_permission = true;
|
||||||
|
|
||||||
|
for (const role of user.roles) {
|
||||||
|
if (data_asset.roles.includes(role)) has_permission = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data_asset.users.includes(user.user_id)) has_permission = true;
|
||||||
|
|
||||||
|
if (isDataAdmin || has_permission) {
|
||||||
|
delete data_asset.p_roles;
|
||||||
|
delete data_asset.p_users;
|
||||||
|
data_assets.push(data_asset as IDataAsset);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const assets = await this.catalogService.getAssetsUsersAndRoles(data_assets, user.customer_id);
|
||||||
|
|
||||||
|
return assets;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
export type ReleaseNoteDTO = {
|
||||||
|
id: string;
|
||||||
|
date: string;
|
||||||
|
tag: string;
|
||||||
|
title: string;
|
||||||
|
visible: boolean;
|
||||||
|
expiryDate: string;
|
||||||
|
content: string;
|
||||||
|
showEmojis: boolean;
|
||||||
|
image?: string;
|
||||||
|
link?: string;
|
||||||
|
linkText?: string;
|
||||||
|
};
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
|
import { ReleaseNoteController } from './release_note.controller';
|
||||||
|
import { ReleaseNoteService } from './release_note.service';
|
||||||
|
|
||||||
|
describe('ReleaseNoteController', () => {
|
||||||
|
let controller: ReleaseNoteController;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
|
controllers: [ReleaseNoteController],
|
||||||
|
providers: [ReleaseNoteService],
|
||||||
|
}).compile();
|
||||||
|
|
||||||
|
controller = module.get<ReleaseNoteController>(ReleaseNoteController);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be defined', () => {
|
||||||
|
expect(controller).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { Controller, Get, Inject } from '@nestjs/common';
|
||||||
|
import { ReleaseNoteService } from './release_note.service';
|
||||||
|
import { Authenticated } from 'src/decorators/authentication.decorator';
|
||||||
|
import { Language } from 'src/decorators/language.decorator';
|
||||||
|
import { LanguageEnum } from 'src/utils/languages.enum';
|
||||||
|
import DadosferaLogger from '@dadosfera/dadosfera-logs';
|
||||||
|
|
||||||
|
@Controller('release_note')
|
||||||
|
@Authenticated()
|
||||||
|
export class ReleaseNoteController {
|
||||||
|
logger: DadosferaLogger;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
@Inject(DadosferaLogger)
|
||||||
|
dadosferaLogger: DadosferaLogger,
|
||||||
|
private readonly releaseNoteService: ReleaseNoteService,
|
||||||
|
) {
|
||||||
|
this.logger = dadosferaLogger.logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get()
|
||||||
|
async getLatestReleaseNote(@Language() language: LanguageEnum) {
|
||||||
|
this.logger.info(`Fetching latest release note for language: ${language}`);
|
||||||
|
return await this.releaseNoteService.getLatestReleaseNote(language);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { ReleaseNoteService } from './release_note.service';
|
||||||
|
import { ReleaseNoteController } from './release_note.controller';
|
||||||
|
import DadosferaLogger from '@dadosfera/dadosfera-logs';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
controllers: [ReleaseNoteController],
|
||||||
|
providers: [ReleaseNoteService, DadosferaLogger]
|
||||||
|
})
|
||||||
|
export class ReleaseNoteModule {}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
|
import { ReleaseNoteService } from './release_note.service';
|
||||||
|
|
||||||
|
describe('ReleaseNoteService', () => {
|
||||||
|
let service: ReleaseNoteService;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const module: TestingModule = await Test.createTestingModule({
|
||||||
|
providers: [ReleaseNoteService],
|
||||||
|
}).compile();
|
||||||
|
|
||||||
|
service = module.get<ReleaseNoteService>(ReleaseNoteService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be defined', () => {
|
||||||
|
expect(service).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
|
import axios, { AxiosInstance } from 'axios';
|
||||||
|
import { LanguageEnum } from 'src/utils/languages.enum';
|
||||||
|
import { ReleaseNoteDTO } from './dto/release_note.dto';
|
||||||
|
import DadosferaLogger from '@dadosfera/dadosfera-logs';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class ReleaseNoteService {
|
||||||
|
client: AxiosInstance;
|
||||||
|
logger: DadosferaLogger;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
@Inject(DadosferaLogger)
|
||||||
|
dadosferaLogger: DadosferaLogger,
|
||||||
|
) {
|
||||||
|
this.logger = dadosferaLogger.logger;
|
||||||
|
this.client = axios.create({
|
||||||
|
baseURL: process.env.FIREBASE_BASE_URL,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getLatestReleaseNote(lang: LanguageEnum) {
|
||||||
|
try {
|
||||||
|
const lng = lang.split('-');
|
||||||
|
const language = lng[0] + '-' + lng[1].toUpperCase();
|
||||||
|
|
||||||
|
const endpoint = `/release_note/${language}.json`;
|
||||||
|
const {
|
||||||
|
data,
|
||||||
|
status,
|
||||||
|
config
|
||||||
|
} = await this.client.get<ReleaseNoteDTO>(endpoint)
|
||||||
|
this.logger.info(`Fetched release note for language: ${lang} with status: ${status}`);
|
||||||
|
this.logger.info(`Request URL: ${config.baseURL}/${config.url}`);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
} catch (error) {
|
||||||
|
this.logger.error(`Error fetching release note: ${error.message}`);
|
||||||
|
|
||||||
|
if (axios.isAxiosError(error)) {
|
||||||
|
this.logger.error(`Axios error details: ${error.toJSON()}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user