mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-09 13:59:07 +00:00
update protospack and better adjustInputPayload
This commit is contained in:
@@ -38,9 +38,11 @@ export class InputsClientService implements OnModuleInit {
|
||||
async newCreate(createInputDto: InputNewCreateRequest) {
|
||||
console.log('InputClientService', 'Create');
|
||||
|
||||
return await lastValueFrom(
|
||||
const input = await lastValueFrom(
|
||||
this.inputService.NewCreate(objectSnakeToCamel(createInputDto)),
|
||||
);
|
||||
objectCamelToSnake(input);
|
||||
return input;
|
||||
}
|
||||
|
||||
async createGeneric(createInputGeneric) {
|
||||
@@ -55,11 +57,12 @@ export class InputsClientService implements OnModuleInit {
|
||||
};
|
||||
objectSnakeToCamel(grpcPayload);
|
||||
|
||||
const structPayload = await lastValueFrom(
|
||||
const structReturn = await lastValueFrom(
|
||||
this.inputService.Create(grpcPayload),
|
||||
);
|
||||
objectCamelToSnake(structPayload);
|
||||
return DecodeGrpcStruct(structPayload.input);
|
||||
objectCamelToSnake(structReturn);
|
||||
const inputCreated = DecodeGrpcStruct(structReturn.input);
|
||||
return { input: inputCreated };
|
||||
}
|
||||
|
||||
async createS3Inputs(createInputDto: InputCreateS3Request) {
|
||||
|
||||
@@ -13,6 +13,7 @@ export class InputsService {
|
||||
|
||||
adjustInputPayload(payload) {
|
||||
if (payload?.input_generic) return DecodeGrpcStruct(payload.input_generic);
|
||||
if (!payload.input_s3 && !payload.input_jdbc) return payload;
|
||||
return payload?.input_s3 || payload?.input_jdbc;
|
||||
}
|
||||
getDifferenceInSeconds(date1: Date, date2: Date) {
|
||||
@@ -60,17 +61,19 @@ export class InputsService {
|
||||
input: inputPayload,
|
||||
info,
|
||||
});
|
||||
return response;
|
||||
break;
|
||||
case 'oracle':
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
case 'sqlserver':
|
||||
response = await this.inputClient.newCreate(data);
|
||||
return { input: response?.input?.input_jdbc };
|
||||
break;
|
||||
default:
|
||||
response = await this.inputClient.createGeneric(data);
|
||||
return response;
|
||||
break;
|
||||
}
|
||||
const adjustedInput = this.adjustInputPayload(response.input);
|
||||
return { ...response, input: adjustedInput };
|
||||
}
|
||||
async getAvailableEntities(data): Promise<{ entities: string[] }> {
|
||||
return await this.inputClient.getAvailableEntities(data);
|
||||
|
||||
Reference in New Issue
Block a user