mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-07 20:59:09 +00:00
Inputs models refactor
This commit is contained in:
@@ -149,6 +149,7 @@ export class InputsService {
|
||||
return response;
|
||||
},
|
||||
};
|
||||
|
||||
secondsInADay = 60 * 60 * 24;
|
||||
secondsInAnHour = 60 * 60;
|
||||
|
||||
@@ -163,6 +164,12 @@ export class InputsService {
|
||||
}
|
||||
if (payload.input_s3) return payload.input_s3;
|
||||
if (payload.input_jdbc) return payload.input_jdbc;
|
||||
|
||||
const { credentials } = payload;
|
||||
return {
|
||||
...payload,
|
||||
credentials: credentials && JSON.parse(credentials),
|
||||
};
|
||||
}
|
||||
return payload;
|
||||
}
|
||||
@@ -216,9 +223,11 @@ export class InputsService {
|
||||
const adjustedInput = this.adjustInputPayload(input);
|
||||
return { input: adjustedInput };
|
||||
}
|
||||
|
||||
async getAvailableEntities(data): Promise<{ entities: string[] }> {
|
||||
return await this.OLD_inputClient.getAvailableEntities(data);
|
||||
}
|
||||
|
||||
async findAll(info: Info) {
|
||||
const { inputs } = await lastValueFrom(
|
||||
this.inputReadService.InputFindAll({ info }),
|
||||
@@ -227,31 +236,6 @@ export class InputsService {
|
||||
|
||||
const inputsReturn = inputs.map((i) => this.adjustInputPayload(i));
|
||||
return { inputs: inputsReturn };
|
||||
// findAll: async (data) => {
|
||||
// this.logger.info('InputClientService - FindAll');
|
||||
// const findAllInputResponse = await lastValueFrom(
|
||||
// this.inputReadService.InputFindAll(data),
|
||||
// ).catch((e) => {
|
||||
// this.logger.error(e.details);
|
||||
// throw new HttpException(e.details, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
// });
|
||||
// findAllInputResponse.inputs.forEach((input) => objectCamelToSnake(input));
|
||||
|
||||
// return findAllInputResponse;
|
||||
// },
|
||||
// try {
|
||||
// const findAllInputResponse: any = await this.OLD_inputClient.findAll(
|
||||
// body,
|
||||
// );
|
||||
// if (findAllInputResponse?.inputs?.length) {
|
||||
// findAllInputResponse.inputs = findAllInputResponse.inputs.map((input) =>
|
||||
// this.adjustInputPayload(input),
|
||||
// );
|
||||
// }
|
||||
// return findAllInputResponse;
|
||||
// } catch (err) {
|
||||
// throw new HttpException(err.message, HttpStatus.NOT_FOUND);
|
||||
// }
|
||||
}
|
||||
|
||||
async findOne(idRequest: IIdRequest) {
|
||||
|
||||
Reference in New Issue
Block a user