Skip to content

Commit

Permalink
Merge pull request #405 from lahirulakruwan/main
Browse files Browse the repository at this point in the history
Enrollment bff update person api changes added
  • Loading branch information
YujithIsura authored Sep 30, 2024
2 parents 2365b7f + f070b8d commit 8fa77cc
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
28 changes: 28 additions & 0 deletions campus/bffs/enrollment/api/service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,32 @@ service / on new http:Listener(9095) {
}
}

resource function put update_person(@http:Payload Person person) returns Person|error {

Address permanent_address = <Address>person?.permanent_address;
Address mailing_address = <Address>person?.mailing_address;
anydata remove_permanent_address = person.remove("permanent_address");
anydata remove_mailing_address = person.remove("mailing_address");

log:printDebug(remove_permanent_address.toString());
log:printDebug(remove_mailing_address.toString());


UpdatePersonResponse|graphql:ClientError updatePersonResponse = globalDataClient->updatePerson(mailing_address,person,permanent_address);
if (updatePersonResponse is UpdatePersonResponse) {
Person|error person_record = updatePersonResponse.update_person.cloneWithType(Person);
if (person_record is Person) {
return person_record;
}
else {
return error("Error while processing Application record received: " + person_record.message() +
":: Detail: " + person_record.detail().toString());
}
} else {
log:printError("Error while updating record", updatePersonResponse);
return error("Error while updating record: " + updatePersonResponse.message() +
":: Detail: " + updatePersonResponse.detail().toString());
}
}

}
8 changes: 4 additions & 4 deletions campus/bffs/enrollment/api/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public type District record {
string? name_si?;
int? id?;
string? record_type?;
int? province_id?;
int province_id?;
Province? province?;
City[]? cities?;
};
Expand All @@ -53,16 +53,16 @@ public type City record {
string? record_type?;
int? id?;
District? district?;
int? district_id?;
int district_id?;
string name_en?;
string? name_ta?;
string? name_si?;
string? suburb_name_en?;
string? suburb_name_ta?;
string? suburb_name_si?;
string? postcode?;
decimal? latitude?;
decimal? longitude?;
decimal latitude?;
decimal longitude?;
};

public type Province record {
Expand Down

0 comments on commit 8fa77cc

Please sign in to comment.