mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-15 23:19:08 +00:00
REFACTOR: Att Functions + Alpha Clients connection
This commit is contained in:
@@ -9,7 +9,7 @@ export class TransformationsClientConfiguration {
|
||||
options: {
|
||||
url: process.env.TRFACTORY_URL,
|
||||
package: 'transformation',
|
||||
// credentials: credentials.createSsl(),
|
||||
credentials: credentials.createSsl(),
|
||||
protoPath: TransformationProtofile,
|
||||
loader: {
|
||||
enums: String,
|
||||
|
||||
@@ -16,7 +16,8 @@ import {
|
||||
} from '@nestjs/microservices';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { TransformationsServiceInterface } from '@victorradael/protospack';
|
||||
import { ICreateTransformationElement, ICreateTransformationsRequest, IdRequest, IUpdateTransformationRequest } from './interfaces';
|
||||
import { objectCamelToSnake } from 'src/utils/CaseConverter';
|
||||
import { Transformation, ICreateTransformationsRequest, IdRequest, IUpdateTransformationRequest } from './interfaces';
|
||||
|
||||
@Controller('transformation')
|
||||
export class TransformationsClientService implements OnModuleInit {
|
||||
@@ -54,7 +55,12 @@ export class TransformationsClientService implements OnModuleInit {
|
||||
.catch((err) => {
|
||||
throw new Error(err);
|
||||
});
|
||||
return createTransformationResponse;
|
||||
|
||||
const convertedTransforms = createTransformationResponse["transformations"].map((tr)=>{
|
||||
return objectCamelToSnake(tr)
|
||||
})
|
||||
|
||||
return {transformations:convertedTransforms};
|
||||
}
|
||||
|
||||
async findAll() {
|
||||
@@ -78,8 +84,10 @@ export class TransformationsClientService implements OnModuleInit {
|
||||
.catch((err) => {
|
||||
throw new Error(err);
|
||||
});
|
||||
|
||||
return findAllTransformationResponse;
|
||||
const convertedTransforms = findAllTransformationResponse["transformations"].map((tr)=>{
|
||||
return objectCamelToSnake(tr)
|
||||
})
|
||||
return {transformations:convertedTransforms};
|
||||
}
|
||||
|
||||
async findOne({id}: IdRequest) {
|
||||
@@ -104,7 +112,7 @@ export class TransformationsClientService implements OnModuleInit {
|
||||
throw new Error(err);
|
||||
});
|
||||
|
||||
return findOneTransformationResponse;
|
||||
return objectCamelToSnake(findOneTransformationResponse);
|
||||
}
|
||||
|
||||
async update(updateTransformationDTO: IUpdateTransformationRequest) {
|
||||
@@ -129,7 +137,7 @@ export class TransformationsClientService implements OnModuleInit {
|
||||
throw new Error(err);
|
||||
});
|
||||
|
||||
return updateTransformationResponse;
|
||||
return objectCamelToSnake(updateTransformationResponse);
|
||||
}
|
||||
|
||||
async remove({id}: IdRequest) {
|
||||
@@ -154,6 +162,6 @@ export class TransformationsClientService implements OnModuleInit {
|
||||
throw new Error(err);
|
||||
});
|
||||
|
||||
return removeTransformationResponse;
|
||||
return objectCamelToSnake(removeTransformationResponse);
|
||||
}
|
||||
}
|
||||
|
||||
+12
-15
@@ -1,15 +1,18 @@
|
||||
export interface ICreateTransformationsRequest {
|
||||
transformations: ICreateTransformationElement[];
|
||||
transformations: Transformation[];
|
||||
}
|
||||
interface Param {
|
||||
base_column?: string;
|
||||
column_name?: string;
|
||||
n_digits?: number;
|
||||
start_index?: number;
|
||||
randbelow?: number;
|
||||
const?: string;
|
||||
base_column: string;
|
||||
column_name: string;
|
||||
n_digits: number;
|
||||
start_index: number;
|
||||
randbelow: number;
|
||||
const: string;
|
||||
}
|
||||
export interface ICreateTransformationElement {
|
||||
interface Transformation {
|
||||
created_at: string;
|
||||
id: string;
|
||||
client_id: string;
|
||||
type: string;
|
||||
params: Param[];
|
||||
input_source: string;
|
||||
@@ -21,11 +24,5 @@ export interface IdRequest{
|
||||
}
|
||||
|
||||
export interface IUpdateTransformationRequest {
|
||||
created_at?: string;
|
||||
id?: string;
|
||||
client_id?: string;
|
||||
params: Param[];
|
||||
type?: string;
|
||||
input_source?: string;
|
||||
table?: string;
|
||||
transformation: Transformation;
|
||||
}
|
||||
Reference in New Issue
Block a user