FEAT: GET One Pipelinev2

This commit is contained in:
Victor Radael
2022-09-02 14:15:36 -03:00
parent 10a89632b5
commit 01bdf134ca
5 changed files with 40 additions and 15 deletions
+7 -7
View File
@@ -12,7 +12,7 @@
"dependencies": {
"@aws-sdk/client-secrets-manager": "^3.112.0",
"@dadosfera/dadosfera-logs": "^1.0.0-beta.3",
"@dadosfera/protospack-v2": "^3.14.9",
"@dadosfera/protospack-v2": "^3.14.10",
"@grpc/grpc-js": "^1.6.7",
"@grpc/proto-loader": "^0.6.13",
"@nestjs/common": "^8.4.7",
@@ -1726,9 +1726,9 @@
}
},
"node_modules/@dadosfera/protospack-v2": {
"version": "3.14.9",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.14.9.tgz",
"integrity": "sha512-i+Tc7rDoGOxTEZ8OZUmoYmjGktpir4OygoEyNneSGBVQfiCiYug95kNQYqt/cB36DIhDhO0Zj+OhCy6ltZPIzA==",
"version": "3.14.10",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.14.10.tgz",
"integrity": "sha512-RP3f4Phq8dIcNjBs6d3VJmmr6H2NfP1vX0LcjGfIUCwczG177HGwZeQLWzKUWF3aIyh3gzb/nNmNmI2j/qWwFA==",
"dependencies": {
"@grpc/grpc-js": "^1.6.7",
"rxjs": "^7.5.5",
@@ -12297,9 +12297,9 @@
}
},
"@dadosfera/protospack-v2": {
"version": "3.14.9",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.14.9.tgz",
"integrity": "sha512-i+Tc7rDoGOxTEZ8OZUmoYmjGktpir4OygoEyNneSGBVQfiCiYug95kNQYqt/cB36DIhDhO0Zj+OhCy6ltZPIzA==",
"version": "3.14.10",
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.14.10.tgz",
"integrity": "sha512-RP3f4Phq8dIcNjBs6d3VJmmr6H2NfP1vX0LcjGfIUCwczG177HGwZeQLWzKUWF3aIyh3gzb/nNmNmI2j/qWwFA==",
"requires": {
"@grpc/grpc-js": "^1.6.7",
"rxjs": "^7.5.5",
+1 -1
View File
@@ -27,7 +27,7 @@
"dependencies": {
"@aws-sdk/client-secrets-manager": "^3.112.0",
"@dadosfera/dadosfera-logs": "^1.0.0-beta.3",
"@dadosfera/protospack-v2": "^3.14.9",
"@dadosfera/protospack-v2": "^3.14.10",
"@grpc/grpc-js": "^1.6.7",
"@grpc/proto-loader": "^0.6.13",
"@nestjs/common": "^8.4.7",
@@ -17,6 +17,7 @@ import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
import { Messages } from '@dadosfera/protospack-v2/dist/lib/PipelineV2';
import { RequestUser, User } from 'src/authentication/user.decorator';
import { PackTheMetadata } from 'src/utils/ PackTheMetadata';
import { pipe } from 'rxjs';
@ApiTags('Pipelines')
@Controller('pipelinesV2')
@@ -100,13 +101,34 @@ export class PipelinesController {
}
@Get('/:id')
async findOne(@Body() data, @Param() params) {
const { id } = params;
async findOne(
@Headers('Dadosfera-Lang') language,
@User() user: RequestUser,
@Param('id') id,
): Promise<Messages.PipelineV2FindOneResponse> {
this.logger.info(process.env.DEV_URL + `/pipeline/${id} ON Find One ROUTE`);
const response = await this.pipelinesClientService.findOne({ id, ...data });
const { customer_id, customer_name, user_id, username } = user;
return response;
const metadata = PackTheMetadata({
customer_id,
customer_name,
user_id,
username,
language,
});
const result = await this.pipelinesClientService.findOne({ id }, metadata);
Object.assign(result.pipeline, {
transformations: JSON.parse(result.pipeline.transformations),
config: {
cron: result.pipeline.config.cron,
tables: JSON.parse(result.pipeline.config.tables),
},
});
return result;
}
@Put('/:id')
+5 -2
View File
@@ -85,11 +85,14 @@ export class PipelinesService implements OnModuleInit {
return findAllPipelineResponse;
}
async findOne(data: Messages.PipelineV2FindOneRequest) {
async findOne(
data: Messages.PipelineV2FindOneRequest,
metadata,
): Promise<Messages.PipelineV2FindOneResponse> {
this.logger.info('PipelinesClientService - FindOne');
const findOnePipelineResponse = await lastValueFrom(
this.pipelineReadService.PipelineV2FindOne(data),
this.pipelineReadService.PipelineV2FindOne(data, metadata),
)
.then((res) => {
this.logger.info('Done');
+1 -1
View File
File diff suppressed because one or more lines are too long