Skip to content

Commit

Permalink
Merge pull request #467 from lahirulakruwan/main
Browse files Browse the repository at this point in the history
Class icons added to the icon folder
  • Loading branch information
YujithIsura authored Jan 22, 2025
2 parents da38831 + 0b4b1ae commit 69124a5
Show file tree
Hide file tree
Showing 22 changed files with 1,355 additions and 371 deletions.
4 changes: 2 additions & 2 deletions campus/bffs/attendance/api/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.17"
version = "2.10.19"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "cache"},
Expand Down Expand Up @@ -357,7 +357,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "websocket"
version = "2.10.2"
version = "2.10.3"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "constraint"},
Expand Down
11 changes: 9 additions & 2 deletions campus/bffs/enrollment/api/client.bal
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ public isolated client class GraphqlClient {
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 mailing_address {city {id name {name_en name_si name_ta} district {id name {name_en}}} 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 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 created_by updated_by current_job document_list {document document_type}}}`;
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 mailing_address {city {id name {name_en name_si name_ta} district {id name {name_en}}} 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 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 created_by updated_by current_job documents_id}}`;
map<anydata> variables = {"id": id};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetPersonByIdResponse>check performDataBinding(graphqlResponse, GetPersonByIdResponse);
}

remote isolated function updatePerson(Person person, City? permanent_address_city = (), Address? mailing_address = (), 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 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 created_by updated_by current_job}}`;
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};
Expand Down Expand Up @@ -77,4 +77,11 @@ public isolated client class GraphqlClient {
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <UploadDocumentResponse>check performDataBinding(graphqlResponse, UploadDocumentResponse);
}

remote isolated function getAllDocuments(int id) returns GetAllDocumentsResponse|graphql:ClientError {
string query = string `query getAllDocuments($id:Int!) {document_list(id:$id) {document document_type}}`;
map<anydata> variables = {"id": id};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetAllDocumentsResponse>check performDataBinding(graphqlResponse, GetAllDocumentsResponse);
}
}
26 changes: 26 additions & 0 deletions campus/bffs/enrollment/api/service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,32 @@ service / on new http:Listener(9095) {
};
}
}

resource function get document_list/[int id]() returns UserDocument[]|error {
GetAllDocumentsResponse|graphql:ClientError getDocumentsResponse = globalDataClient->getAllDocuments(id);
if (getDocumentsResponse is GetAllDocumentsResponse) {
UserDocument[] document_datas = [];
foreach var document_data in getDocumentsResponse.document_list {
UserDocument|error document_data_record = document_data.cloneWithType(UserDocument);
if (document_data_record is UserDocument) {
document_datas.push(document_data_record);
} else {
log:printError("Error while processing Application record received", document_data_record);
return error("Error while processing Application record received: " + document_data_record.message() +
":: Detail: " + document_data_record.detail().toString());
}
}

return document_datas;

} else {
log:printError("Error while getting application", getDocumentsResponse);
return error("Error while getting application: " + getDocumentsResponse.message() +
":: Detail: " + getDocumentsResponse.detail().toString());
}
}


// resource function post add_person(http:Request req) returns Person|error {
// UserDocumentList[] documents = [];
// Person person = {};
Expand Down
16 changes: 10 additions & 6 deletions campus/bffs/enrollment/api/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public type Person record {
string? notes?;
int[]? parent_student?;
string? date_of_birth?;
int? parent_organization_id?;
int? avinya_type_id?;
Address? permanent_address?;
int? mailing_address_id?;
Expand All @@ -105,7 +106,6 @@ public type Person record {
string? full_name?;
string? nic_no?;
int? phone?;
UserDocument[]? documentList?;
int? organization_id?;
int? updated_by?;
string? academy_org_name?;
Expand Down Expand Up @@ -293,13 +293,9 @@ public type GetPersonByIdResponse record {|
int? created_by;
int? updated_by;
string? current_job;
record {|
string? document;
string? document_type;
|}[]? document_list;
int? documents_id;
|}? person_by_id;
|};

public type UpdatePersonResponse record {|
map<json?> __extensions?;
record {|
Expand Down Expand Up @@ -539,3 +535,11 @@ public type UploadDocumentResponse record {|
string? additional_certificate_05_id;
|}? upload_document;
|};

public type GetAllDocumentsResponse record {|
map<json?> __extensions?;
record {|
string? document;
string? document_type;
|}[] document_list;
|};
12 changes: 8 additions & 4 deletions campus/bffs/enrollment/graphql_client/enrollment.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,7 @@ query getPersonById($id: Int!) {
created_by
updated_by
current_job
document_list {
document
document_type
}
documents_id
}
}

Expand Down Expand Up @@ -409,3 +406,10 @@ mutation uploadDocument($user_document: UserDocument!) {
additional_certificate_05_id
}
}

query getAllDocuments($id: Int!) {
document_list(id: $id) {
document
document_type
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public isolated client class GraphqlClient {
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 mailing_address {city {id name {name_en name_si name_ta} district {id name {name_en}}} 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 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 created_by updated_by current_job document_list {document document_type}}}`;
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 mailing_address {city {id name {name_en name_si name_ta} district {id name {name_en}}} 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 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 created_by updated_by current_job documents_id}}`;
map<anydata> variables = {"id": id};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetPersonByIdResponse> check performDataBinding(graphqlResponse, GetPersonByIdResponse);
Expand Down Expand Up @@ -81,4 +81,10 @@ public isolated client class GraphqlClient {
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <UploadDocumentResponse> check performDataBinding(graphqlResponse, UploadDocumentResponse);
}
remote isolated function getAllDocuments(int id) returns GetAllDocumentsResponse|graphql:ClientError {
string query = string `query getAllDocuments($id:Int!) {document_list(id:$id) {document document_type}}`;
map<anydata> variables = {"id": id};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetAllDocumentsResponse> check performDataBinding(graphqlResponse, GetAllDocumentsResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ public type Person record {
string? notes?;
int[]? parent_student?;
string? date_of_birth?;
int? parent_organization_id?;
int? avinya_type_id?;
Address? permanent_address?;
int? mailing_address_id?;
Expand All @@ -336,7 +337,6 @@ public type Person record {
string? full_name?;
string? nic_no?;
int? phone?;
UserDocument[]? documentList?;
int? organization_id?;
int? updated_by?;
string? academy_org_name?;
Expand Down Expand Up @@ -615,10 +615,7 @@ public type GetPersonByIdResponse record {|
int? created_by;
int? updated_by;
string? current_job;
record {|
string? document;
string? document_type;
|}[]? document_list;
int? documents_id;
|}? person_by_id;
|};

Expand Down Expand Up @@ -863,3 +860,11 @@ public type UploadDocumentResponse record {|
string? additional_certificate_05_id;
|}? upload_document;
|};

public type GetAllDocumentsResponse record {|
map<json?> __extensions?;
record {|
string? document;
string? document_type;
|}[]? document_list;
|};
5 changes: 3 additions & 2 deletions campus/bffs/enrollment/graphql_client/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ input Person {
mailing_address_id: Int
phone: Int
organization_id: Int
parent_organization_id: Int
avinya_type_id: Int
notes: String
nic_no: String
Expand All @@ -804,7 +805,6 @@ input Person {
branch_code: String
current_job: String
documents_id: Int
documentList: [UserDocument!]
created_by: Int
updated_by: Int
}
Expand Down Expand Up @@ -842,12 +842,12 @@ type PersonData {
bank_account_name: String
academy_org_id: Int
organization_id: Int
parent_organization_id: Int
branch_code: String
current_job: String
created_by: Int
updated_by: Int
documents_id: Int
document_list: [DocumentsData!]
}

type PlaceData {
Expand Down Expand Up @@ -987,6 +987,7 @@ type Query {
consumable_yearly_report(organization_id: Int, consumable_id: Int, year: Int): [InventoryData!]
persons(organization_id: Int, avinya_type_id: Int): [PersonData!]
person_by_id(id: Int): PersonData
document_list(id: Int!): [DocumentsData!]
districts: [DistrictData!]
cities(district_id: Int): [CityData!]
all_organizations: [OrganizationData!]
Expand Down
Loading

0 comments on commit 69124a5

Please sign in to comment.