Skip to content

Commit

Permalink
Merge pull request #172 from YujithIsura/main
Browse files Browse the repository at this point in the history
lint
  • Loading branch information
YujithIsura authored Oct 7, 2024
2 parents 266cb5a + 166aee4 commit 65b963b
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions api/main.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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'.");
Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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 {
Expand All @@ -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(
Expand Down Expand Up @@ -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;
Expand All @@ -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,<int?>insert_person_id);
return new (null, <int?>insert_person_id);
}
}

Expand Down

0 comments on commit 65b963b

Please sign in to comment.