diff --git a/api/main.bal b/api/main.bal index 393a4b1..c2c30a2 100644 --- a/api/main.bal +++ b/api/main.bal @@ -5519,11 +5519,7 @@ AND p.organization_id IN ( `SELECT * from person p where - p.avinya_type_id = ${avinya_type_id} and - p.organization_id IN( - Select child_org_id - from parent_child_organization pco - );`); + p.avinya_type_id = ${avinya_type_id};`); } } else { return error("Provide non-null values for both 'organization_id' and 'avinya_type_id'."); @@ -5579,7 +5575,7 @@ AND p.organization_id IN ( if (permanent_address_raw is Address) { io:println("Permanent Address is already exists!"); - if (permanent_address != null && permanent_address_city != null ) { + if (permanent_address != null && permanent_address_city != null) { permanent_address_res = check db_client->execute( `UPDATE address SET @@ -5597,10 +5593,9 @@ AND p.organization_id IN ( } } - } else { - if (permanent_address != null && permanent_address_city != null ) { + if (permanent_address != null && permanent_address_city != null) { permanent_address_res = check db_client->execute( `INSERT INTO address( @@ -5745,7 +5740,7 @@ AND p.organization_id IN ( boolean third_db_transaction_fail = false; int|string? mailing_address_insert_id = null; - + string message = ""; transaction { @@ -5758,13 +5753,12 @@ AND p.organization_id IN ( ); if (personRaw is Person) { - first_db_transaction_fail = true; - io:println("Person already exists."); - message="Person already exists."; + first_db_transaction_fail = true; + io:println("Person already exists."); + message = "Person already exists."; } - - if (mailing_address != null && mailing_address_city != null ) { + if (mailing_address != null && mailing_address_city != null) { sql:ExecutionResult mailing_address_res = check db_client->execute( `INSERT INTO address( @@ -5834,7 +5828,7 @@ AND p.organization_id IN ( ${person.created_by} );`); - int|string? insert_person_id = insert_person_res.lastInsertId; + int|string? insert_person_id = insert_person_res.lastInsertId; if !(insert_person_id is int) { third_db_transaction_fail = true; @@ -5853,7 +5847,7 @@ AND p.organization_id IN ( // Commit the transaction if three updates are successful check commit; io:println("Transaction committed successfully!"); - return new (null,insert_person_id); + return new (null, insert_person_id); } }