Edit: I' ve found a similar question and resolved this with this code:
testeTipoMySQLtoOracle(testeTipo: any) {
var tipoNumber = {
"aceitacao": 1,
"integracao": 4,
"interface-mobile": 5,
"interface-web": 6,
"performance": 7,
"unitario": 8,
};
var indice: keyof typeof tipoNumber = testeTipo;
if (indice in tipoNumber) {
return tipoNumber[indice];
}
}
I Want to receive a value and change it before sending a request to my DataBase. One DataBase send me a string and I must assign its equivalent number before sending it to the other DataBase.
Here is what I have so far:
testeTipoMySQL(testeTipo: string){
if(testeTipo == "aceitacao"){
return 1;
}else if(testeTipo == "integracao"){
return 4;
}else if(testeTipo == "interface-mobile"){
return 5;
}else if(testeTipo == "interface-web"){
return 6;
}else if(testeTipo == "performance"){
return 7;
}else if(testeTipo == "unitario"){
return 8;
}
}
I want to know if is there another better way of doing it that I'm not seeing cause I'm new to JavasCript.