#1121494527727902891 hello, I have a bot that must receive a variable from the client, which is the identification, with it I must search for it in the table, when finding the identification, I must update two more fields, the email and the telephone, however, when searching for the identification in The table, with the attached code, gives me the following error.
Error executing action "inline-card:Get customer ID and information by cedula from database..js" in flow:Main:node:Captura_datos
[SyntaxError, Unexpected token 'export']
{"scope":"bot-action","cardId":"card:Get customer ID and information by cedula from database.","nodeId":"node:Captura_datos","workflowId":"flow:Main"}
module.exports = async (bp: any, state: any, event: any, params: any) => {
try {
const cedula = state.workflow.idcedula; // Obtener la cédula del estado del flujo
const DinobdTable = await bp.db.getTable('dinobdTable'); // Obtener la tabla 'dinobdTable'
// Buscar el registro del cliente por cédula
const customer = await DinobdTable.findOne ({ where: { cc: cedula } });
if (!customer) {
throw new Error("Customer not found"); // Lanzar un error si no se encuentra el cliente
}
// Guardar el ID del cliente en el estado del flujo
state.workflow.userId = customer.id;
// Guardar el registro completo del cliente en el estado del flujo
state.workflow.customer = customer;
} catch (error) {
console.error("Error in getCustomerIdByCedula:", error);
throw error;
}
};