mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-10 23:14:48 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2de729e0e | ||
|
|
e2cb02e51a | ||
|
|
8a0c91eca5 | ||
|
|
15302d80bc | ||
|
|
5aa63154c5 | ||
|
|
48af897e79 | ||
|
|
9eb61a0ac9 | ||
|
|
4a9e5b0ffc |
+1
-1
@@ -3287,7 +3287,7 @@
|
||||
}
|
||||
},
|
||||
"info": {
|
||||
"title": "Maestro - feat/upload-csv",
|
||||
"title": "Maestro - feat/cognito-app-client",
|
||||
"description": "Documentation for Maestro gateway",
|
||||
"version": "1.0.0",
|
||||
"contact": {}
|
||||
|
||||
Generated
+7
-7
@@ -12,7 +12,7 @@
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-secrets-manager": "^3.112.0",
|
||||
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
||||
"@dadosfera/protospack-v2": "3.23.0",
|
||||
"@dadosfera/protospack-v2": "3.24.0",
|
||||
"@grpc/grpc-js": "^1.6.7",
|
||||
"@grpc/proto-loader": "^0.6.13",
|
||||
"@nestjs/common": "^8.4.7",
|
||||
@@ -1727,9 +1727,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@dadosfera/protospack-v2": {
|
||||
"version": "3.23.0",
|
||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.23.0.tgz",
|
||||
"integrity": "sha512-pe2s7aJYaNlUhQ+QoMGkJoFjTS8Dh+xSgUClSJuCsTia17oidRAucfpeMUX9ws1a3+tDrXTpH519CxeHzuZQPA==",
|
||||
"version": "3.24.0",
|
||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.24.0.tgz",
|
||||
"integrity": "sha512-CZmRK2shS8y7t6F2e1PSe8T+GgQJVXQPNYmcBqeWfb/ZmfL9zS2dDCACqbJpzBg2nmEneznYtpTw4nfH8n3utw==",
|
||||
"dependencies": {
|
||||
"@grpc/grpc-js": "^1.6.7",
|
||||
"rxjs": "^7.5.5",
|
||||
@@ -12324,9 +12324,9 @@
|
||||
}
|
||||
},
|
||||
"@dadosfera/protospack-v2": {
|
||||
"version": "3.23.0",
|
||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.23.0.tgz",
|
||||
"integrity": "sha512-pe2s7aJYaNlUhQ+QoMGkJoFjTS8Dh+xSgUClSJuCsTia17oidRAucfpeMUX9ws1a3+tDrXTpH519CxeHzuZQPA==",
|
||||
"version": "3.24.0",
|
||||
"resolved": "https://dadosfera-611330257153.d.codeartifact.us-east-1.amazonaws.com:443/npm/dadosfera-npm/@dadosfera/protospack-v2/-/protospack-v2-3.24.0.tgz",
|
||||
"integrity": "sha512-CZmRK2shS8y7t6F2e1PSe8T+GgQJVXQPNYmcBqeWfb/ZmfL9zS2dDCACqbJpzBg2nmEneznYtpTw4nfH8n3utw==",
|
||||
"requires": {
|
||||
"@grpc/grpc-js": "^1.6.7",
|
||||
"rxjs": "^7.5.5",
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-secrets-manager": "^3.112.0",
|
||||
"@dadosfera/dadosfera-logs": "^1.0.0-beta.4",
|
||||
"@dadosfera/protospack-v2": "3.23.0",
|
||||
"@dadosfera/protospack-v2": "3.24.0",
|
||||
"@grpc/grpc-js": "^1.6.7",
|
||||
"@grpc/proto-loader": "^0.6.13",
|
||||
"@nestjs/common": "^8.4.7",
|
||||
|
||||
@@ -79,10 +79,12 @@ export class AuthController {
|
||||
async refreshAccessToken(
|
||||
@Body() { refreshToken }: AuthRefreshAccessTokenRequest,
|
||||
@Headers('Dadosfera-Lang') language: string,
|
||||
@User() user: RequestUser,
|
||||
) {
|
||||
this.logger.info('/auth - RefreshAccessToken');
|
||||
const metadata = new Metadata();
|
||||
metadata.add('language', language || 'pt-br');
|
||||
metadata.add('customer_name', user.customer_name);
|
||||
|
||||
return this.authClient.refreshAccessToken({ refreshToken }, metadata);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
Patch,
|
||||
UseInterceptors,
|
||||
UploadedFile,
|
||||
HttpException,
|
||||
} from '@nestjs/common';
|
||||
import {
|
||||
ApiConsumes,
|
||||
@@ -265,8 +266,15 @@ export class PipelinesController {
|
||||
) {
|
||||
this.logger.info('/upload - Upload Connector Route');
|
||||
const metadata = PackTheMetadata({ ...user });
|
||||
let name = `${new Date().getTime()}_${file.originalname.split('.')[0]}`;
|
||||
|
||||
const parts_of_file_name = file.originalname.split('.');
|
||||
const file_format = parts_of_file_name.pop();
|
||||
const file_name = parts_of_file_name.join('.');
|
||||
let name = `${new Date().getTime()}_${file_name}`;
|
||||
body.name ? (name = `${new Date().getTime()}_${body.name}`) : name;
|
||||
|
||||
const source_prefix = `${user.customer_name}/${name}.${file_format}`;
|
||||
|
||||
const response = await this.pipelinesClientService.uploadFile(
|
||||
{
|
||||
file,
|
||||
@@ -275,9 +283,15 @@ export class PipelinesController {
|
||||
metadata,
|
||||
);
|
||||
|
||||
const { sep, header, encoding, description } = body;
|
||||
if (!response.url) {
|
||||
this.logger.info('pipeline/upload - Failed File pipeline');
|
||||
throw new HttpException(
|
||||
'Upload failed, try again in a few minutes, if the problem persists, contact support.',
|
||||
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
);
|
||||
}
|
||||
|
||||
const [file_name, file_format] = file.originalname.split('.');
|
||||
const { sep, header, encoding, description } = body;
|
||||
|
||||
const upload_pipeline = {
|
||||
connection_id: process.env.UPLOAD_FILE_AGENT_CONNECTION,
|
||||
@@ -294,7 +308,7 @@ export class PipelinesController {
|
||||
properties: {
|
||||
engine: 'csv',
|
||||
source_bucket: process.env.BUCKET_CUSTOMER_CSV_ASSETS,
|
||||
source_prefix: `${user.customer_name}/${name}.${file_format}`,
|
||||
source_prefix,
|
||||
file_format_params: { sep, encoding, header: Boolean(header) },
|
||||
is_a_upload_csv: true,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user