Compare commits

...
Author SHA1 Message Date
Gabriel Rosa cf870cff14 FIX: formating payload 2022-05-20 14:06:13 -03:00
2 changed files with 28 additions and 2 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
"@nestjs/platform-express": "^8.4.3",
"@nestjs/schedule": "^1.1.0",
"@nestjs/swagger": "^5.2.1",
"@victorradael/protospack": "^2.3.0",
"@victorradael/protospack": "2.3.0",
"axios": "^0.25.0",
"dotenv": "^14.2.0",
"helmet": "^5.0.2",
+27 -1
View File
@@ -15,8 +15,9 @@ export class InputsService {
data.plugin == 'parquet'
) {
const { info, ...input } = data;
const inputPayload = this.generateInputS3Payload(input);
const createInputResponse = await this.inputClient.createS3Inputs({
input,
input: inputPayload,
info,
});
return createInputResponse;
@@ -95,4 +96,29 @@ export class InputsService {
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
}
}
generateInputS3Payload(payload) {
const { credentials, plugin } = payload;
if (!credentials) return payload;
const {
client_aws_access_key_id,
client_aws_secret_access_key,
file_format_params,
format_file_params,
client_bucket,
file_to_extract,
} = credentials;
const formatedPayload = {
plugin,
source_bucket: client_bucket,
source_prefix: file_to_extract,
auth_parameters: {
aws_access_key_id: client_aws_access_key_id,
aws_secret_access_key: client_aws_secret_access_key,
},
file_format_params: file_format_params || format_file_params,
};
return formatedPayload;
}
}