Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint #415

Merged
merged 6 commits into from
Oct 1, 2024
Merged

lint #415

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main_avinyawebapp-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
npm run test --if-present

- name: Upload artifact for node app
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: node-app
path: campus/deployment/node-app
Expand Down
12 changes: 5 additions & 7 deletions campus/bffs/enrollment/api/client.bal
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,20 @@ public isolated client class GraphqlClient {
}

remote isolated function getPersons(int organization_id, int avinya_type_id) returns GetPersonsResponse|graphql:ClientError {
string query = string `query getPersons($organization_id:Int!,$avinya_type_id:Int!) {persons(organization_id:$organization_id,avinya_type_id:$avinya_type_id) {id preferred_name full_name date_of_birth sex asgardeo_id jwt_sub_id created updated jwt_email permanent_address {city {id name {name_en name_si name_ta}} street_address phone id} mailing_address {city {id name {name_en name_si name_ta}} street_address phone id} phone organization {id description notes address {id} avinya_type {id name} name {name_en}} avinya_type {id name} notes nic_no passport_no id_no email street_address digital_id avinya_phone bank_name bank_account_number bank_account_name academy_org_id bank_branch}}`;
string query = string `query getPersons($organization_id:Int!,$avinya_type_id:Int!) {persons(organization_id:$organization_id,avinya_type_id:$avinya_type_id) {id preferred_name full_name date_of_birth sex asgardeo_id jwt_sub_id created updated jwt_email permanent_address {city {id name {name_en name_si name_ta}} street_address phone id} mailing_address {city {id name {name_en name_si name_ta}} street_address phone id} phone organization {id description notes address {id} avinya_type {id name} name {name_en} parent_organizations {id name {name_en}}} avinya_type {id name} notes nic_no passport_no id_no email street_address digital_id avinya_phone bank_name bank_account_number bank_account_name academy_org_id bank_branch}}`;
map<anydata> variables = {"organization_id": organization_id, "avinya_type_id": avinya_type_id};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetPersonsResponse>check performDataBinding(graphqlResponse, GetPersonsResponse);
}

remote isolated function getPersonById(int id) returns GetPersonByIdResponse|graphql:ClientError {
string query = string `query getPersonById($id:Int!) {person_by_id(id:$id) {id preferred_name full_name date_of_birth sex asgardeo_id jwt_sub_id created updated jwt_email permanent_address {city {id name {name_en name_si name_ta}} street_address phone id} mailing_address {city {id name {name_en name_si name_ta}} street_address phone id} phone organization {id description notes address {id} avinya_type {id name} name {name_en}} avinya_type {id name} notes nic_no passport_no id_no email street_address digital_id avinya_phone bank_name bank_account_number bank_account_name academy_org_id bank_branch}}`;
string query = string `query getPersonById($id:Int!) {person_by_id(id:$id) {id preferred_name full_name date_of_birth sex asgardeo_id jwt_sub_id created updated jwt_email permanent_address {city {id name {name_en name_si name_ta}} street_address phone id} mailing_address {city {id name {name_en name_si name_ta}} street_address phone id} phone organization {id description notes address {id} avinya_type {id name} name {name_en} parent_organizations {id name {name_en}}} avinya_type {id name} notes nic_no passport_no id_no email street_address digital_id avinya_phone bank_name bank_account_number bank_account_name academy_org_id bank_branch}}`;
map<anydata> variables = {"id": id};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetPersonByIdResponse>check performDataBinding(graphqlResponse, GetPersonByIdResponse);
}

remote isolated function updatePerson(Address mailing_address, Person person, Address permanent_address) returns UpdatePersonResponse|graphql:ClientError {
string query = string `mutation updatePerson($person:Person!,$permanent_address:Address!,$mailing_address:Address!) {update_person(person:$person,permanent_address:$permanent_address,mailing_address:$mailing_address) {id preferred_name full_name date_of_birth sex asgardeo_id jwt_sub_id created updated jwt_email permanent_address {city {id name {name_en name_si name_ta}} street_address phone id} mailing_address {city {id name {name_en name_si name_ta}} street_address phone id} phone organization {id description notes address {id} avinya_type {id name} name {name_en}} avinya_type {id name} notes nic_no passport_no id_no email street_address digital_id avinya_phone bank_name bank_account_number bank_account_name academy_org_id bank_branch}}`;
map<anydata> variables = {"mailing_address": mailing_address, "person": person, "permanent_address": permanent_address};
remote isolated function updatePerson(City permanent_address_city, Address mailing_address, Person person, Address permanent_address, City mailing_address_city) returns UpdatePersonResponse|graphql:ClientError {
string query = string `mutation updatePerson($person:Person!,$permanent_address:Address!,$permanent_address_city:City!,$mailing_address:Address!,$mailing_address_city:City!) {update_person(person:$person,permanent_address:$permanent_address,permanent_address_city:$permanent_address_city,mailing_address:$mailing_address,mailing_address_city:$mailing_address_city) {id preferred_name full_name date_of_birth sex asgardeo_id jwt_sub_id created updated jwt_email permanent_address {city {id name {name_en name_si name_ta}} street_address phone id} mailing_address {city {id name {name_en name_si name_ta}} street_address phone id} phone organization {id description notes address {id} avinya_type {id name} name {name_en} parent_organizations {id name {name_en}}} avinya_type {id name} notes nic_no passport_no id_no email street_address digital_id avinya_phone bank_name bank_account_number bank_account_name academy_org_id bank_branch}}`;
map<anydata> variables = {"permanent_address_city": permanent_address_city, "mailing_address": mailing_address, "person": person, "permanent_address": permanent_address, "mailing_address_city": mailing_address_city};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <UpdatePersonResponse>check performDataBinding(graphqlResponse, UpdatePersonResponse);
}
Expand Down
9 changes: 7 additions & 2 deletions campus/bffs/enrollment/api/service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,19 @@ service / on new http:Listener(9095) {

Address permanent_address = <Address>person?.permanent_address;
Address mailing_address = <Address>person?.mailing_address;
City permanent_address_city = <City>permanent_address?.city;
City mailing_address_city = <City>mailing_address?.city;
anydata remove_permanent_address_city = permanent_address.remove("city");
anydata remove_mailing_address_city = mailing_address.remove("city");
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());
log:printDebug(remove_permanent_address_city.toString());
log:printDebug(remove_mailing_address_city.toString());


UpdatePersonResponse|graphql:ClientError updatePersonResponse = globalDataClient->updatePerson(mailing_address,person,permanent_address);
UpdatePersonResponse|graphql:ClientError updatePersonResponse = globalDataClient->updatePerson(permanent_address_city,mailing_address,person,permanent_address,mailing_address_city);
if (updatePersonResponse is UpdatePersonResponse) {
Person|error person_record = updatePersonResponse.update_person.cloneWithType(Person);
if (person_record is Person) {
Expand Down
83 changes: 57 additions & 26 deletions campus/bffs/enrollment/api/types.bal
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
public type Address record {
string street_address?;
string? street_address?;
string? name_ta?;
int? phone?;
string? name_si?;
int? id?;
string? record_type?;
int city_id?;
int? city_id?;
string name_en?;
City? city?;
};
Expand All @@ -32,7 +32,7 @@ public type Organization record {
int? avinya_type_id?;
int? id?;
string? record_type?;
string name_en?;
string? name_en?;
string? description?;
string? notes?;
Address? address?;
Expand All @@ -55,15 +55,15 @@ public type City record {
int? id?;
District? district?;
int district_id?;
string name_en?;
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?;
anydata? latitude?;
anydata? longitude?;
};

public type Province record {
Expand Down Expand Up @@ -129,25 +129,25 @@ public type GetPersonsResponse record {|
record {|
int? id;
record {|
string name_en;
string? name_en;
string? name_si;
string? name_ta;
|} name;
|} city;
string street_address;
string? street_address;
int? phone;
int? id;
|}? permanent_address;
record {|
record {|
int? id;
record {|
string name_en;
string? name_en;
string? name_si;
string? name_ta;
|} name;
|} city;
string street_address;
string? street_address;
int? phone;
int? id;
|}? mailing_address;
Expand All @@ -164,8 +164,14 @@ public type GetPersonsResponse record {|
string? name;
|}? avinya_type;
record {|
string name_en;
string? name_en;
|} name;
record {|
int? id;
record {|
string? name_en;
|} name;
|}[]? parent_organizations;
|}? organization;
record {|
int? id;
Expand Down Expand Up @@ -204,25 +210,25 @@ public type GetPersonByIdResponse record {|
record {|
int? id;
record {|
string name_en;
string? name_en;
string? name_si;
string? name_ta;
|} name;
|} city;
string street_address;
string? street_address;
int? phone;
int? id;
|}? permanent_address;
record {|
record {|
int? id;
record {|
string name_en;
string? name_en;
string? name_si;
string? name_ta;
|} name;
|} city;
string street_address;
string? street_address;
int? phone;
int? id;
|}? mailing_address;
Expand All @@ -239,8 +245,14 @@ public type GetPersonByIdResponse record {|
string? name;
|}? avinya_type;
record {|
string name_en;
string? name_en;
|} name;
record {|
int? id;
record {|
string? name_en;
|} name;
|}[]? parent_organizations;
|}? organization;
record {|
int? id;
Expand Down Expand Up @@ -279,25 +291,25 @@ public type UpdatePersonResponse record {|
record {|
int? id;
record {|
string name_en;
string? name_en;
string? name_si;
string? name_ta;
|} name;
|} city;
string street_address;
string? street_address;
int? phone;
int? id;
|}? permanent_address;
record {|
record {|
int? id;
record {|
string name_en;
string? name_en;
string? name_si;
string? name_ta;
|} name;
|} city;
string street_address;
string? street_address;
int? phone;
int? id;
|}? mailing_address;
Expand All @@ -314,8 +326,14 @@ public type UpdatePersonResponse record {|
string? name;
|}? avinya_type;
record {|
string name_en;
string? name_en;
|} name;
record {|
int? id;
record {|
string? name_en;
|} name;
|}[]? parent_organizations;
|}? organization;
record {|
int? id;
Expand Down Expand Up @@ -344,31 +362,44 @@ public type GetDistrictsResponse record {|
record {|
int? id;
record {|
string name_en;
string? name_en;
|} name;
|} province;
record {|
string name_en;
string? name_en;
|} name;
record {|
int? id;
record {|
string name_en;
string? name_en;
|} name;
|}[] cities;
|}[] districts;
|};

public type GetAvinyaTypesResponse record {|
map<json?> __extensions?;
record {|
int? id;
boolean active;
string? name;
string global_type;
string? foundation_type;
string? focus;
int? level;
|}[] avinya_types;
|};

public type GetAllOrganizationsResponse record {|
map<json?> __extensions?;
record {|
int? id;
record {|
string name_en;
string? name_en;
|} name;
record {|
int? id;
string street_address;
string? street_address;
|}? address;
record {|
int? id;
Expand Down
Loading
Loading