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

Enrollment module added #410

Merged
merged 42 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
445f383
Merge remote-tracking branch 'upstream/main'
YujithIsura Sep 3, 2024
e1947ce
Vehicle fuel consumption bff changes added
lahirulakruwan Sep 4, 2024
e4223ff
Merge remote-tracking branch 'upstream/main'
lahirulakruwan Sep 4, 2024
ab6d87f
vehicle fule consumption report WIP
YujithIsura Sep 10, 2024
4a9d9c6
Merge remote-tracking branch 'upstream/main'
YujithIsura Sep 10, 2024
a965f9d
Merge pull request #399 from YujithIsura/main
YujithIsura Sep 10, 2024
2a19e17
Merge pull request #398 from lahirulakruwan/main
YujithIsura Sep 10, 2024
878835c
enrollment function frontend navgation bar changes added
lahirulakruwan Sep 19, 2024
495b07d
Merge remote-tracking branch 'upstream/main'
lahirulakruwan Sep 19, 2024
033024d
Merge pull request #400 from lahirulakruwan/main
YujithIsura Sep 19, 2024
f9aa934
enrollment bff folder structure & persons fetch api bff changes added
lahirulakruwan Sep 23, 2024
1e3cf78
Merge remote-tracking branch 'upstream/main'
lahirulakruwan Sep 23, 2024
b941294
Merge pull request #401 from lahirulakruwan/main
YujithIsura Sep 23, 2024
c7890e7
Students Enrolment interfaces WIP
YujithIsura Sep 23, 2024
edd7b63
Merge remote-tracking branch 'upstream/main'
YujithIsura Sep 23, 2024
12499d6
Person by id api changes added
lahirulakruwan Sep 24, 2024
fda33f7
Merge remote-tracking branch 'upstream/main'
lahirulakruwan Sep 24, 2024
9a252ae
Merge pull request #402 from lahirulakruwan/main
YujithIsura Sep 26, 2024
bf66b19
student update WIP
YujithIsura Sep 26, 2024
324ff13
Merge remote-tracking branch 'upstream/main'
YujithIsura Sep 26, 2024
dc988d6
lint
YujithIsura Sep 26, 2024
bd7e7d3
enrollment bff district api changes added
lahirulakruwan Sep 29, 2024
3cd61b4
Merge remote-tracking branch 'upstream/main'
lahirulakruwan Sep 29, 2024
40b337a
Merge pull request #403 from lahirulakruwan/main
YujithIsura Sep 29, 2024
bf9bbb2
enrollment bff organizations fetch api dechanges added
lahirulakruwan Sep 29, 2024
ab688d8
Merge remote-tracking branch 'upstream/main'
lahirulakruwan Sep 29, 2024
8f3a1c7
student profile WIP
YujithIsura Sep 29, 2024
2365b7f
Merge pull request #404 from lahirulakruwan/main
YujithIsura Sep 29, 2024
87e3947
Merge remote-tracking branch 'upstream/main'
YujithIsura Sep 29, 2024
7b4d739
enrollment bff update person api changes added
lahirulakruwan Sep 29, 2024
d7ad0d2
Merge remote-tracking branch 'upstream/main'
lahirulakruwan Sep 29, 2024
f070b8d
enrollment bff types changes added
lahirulakruwan Sep 29, 2024
8fa77cc
Merge pull request #405 from lahirulakruwan/main
YujithIsura Sep 30, 2024
3033228
student profile WIP
YujithIsura Sep 30, 2024
cd72b92
Merge remote-tracking branch 'upstream/main'
YujithIsura Sep 30, 2024
ed00a00
enrollment bff types changes added
lahirulakruwan Sep 30, 2024
473d4a0
Merge pull request #406 from lahirulakruwan/main
YujithIsura Sep 30, 2024
c9fe56b
bal versioon updated
YujithIsura Sep 30, 2024
9c7a020
Merge remote-tracking branch 'upstream/main'
YujithIsura Sep 30, 2024
cf702c9
Merge pull request #407 from YujithIsura/main
YujithIsura Sep 30, 2024
d779dff
Prod api urls updated
YujithIsura Sep 30, 2024
83a9020
Merge pull request #409 from YujithIsura/main
YujithIsura Sep 30, 2024
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 campus/bffs/asset/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.15"
version = "2.10.16"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "cache"},
Expand Down
48 changes: 48 additions & 0 deletions campus/bffs/asset/api/client.bal
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,52 @@ public isolated client class GraphqlClient {
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetConsumableYearlyReportResponse> check performDataBinding(graphqlResponse, GetConsumableYearlyReportResponse);
}

remote isolated function addVehicleFuelConsumption(VehicleFuelConsumption vehicleFuelConsumption) returns AddVehicleFuelConsumptionResponse|graphql:ClientError {
string query = string `mutation addVehicleFuelConsumption($vehicleFuelConsumption:VehicleFuelConsumption!) {add_vehicle_fuel_consumption(vehicle_fuel_consumption:$vehicleFuelConsumption) {id vehicle_id date_time reason_id starting_meter ending_meter distance comment}}`;
map<anydata> variables = {"vehicleFuelConsumption": vehicleFuelConsumption};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <AddVehicleFuelConsumptionResponse>check performDataBinding(graphqlResponse, AddVehicleFuelConsumptionResponse);
}
remote isolated function updateVehicleFuelConsumption(VehicleFuelConsumption vehicleFuelConsumption) returns UpdateVehicleFuelConsumptionResponse|graphql:ClientError {
string query = string `mutation updateVehicleFuelConsumption($vehicleFuelConsumption:VehicleFuelConsumption!) {update_vehicle_fuel_consumption(vehicle_fuel_consumption:$vehicleFuelConsumption) {id vehicle_id date_time reason_id starting_meter ending_meter distance comment}}`;
map<anydata> variables = {"vehicleFuelConsumption": vehicleFuelConsumption};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <UpdateVehicleFuelConsumptionResponse>check performDataBinding(graphqlResponse, UpdateVehicleFuelConsumptionResponse);
}

remote isolated function deleteVehicleFuelConsumptionById(int id) returns json|error {
string query = string `mutation deleteVehicleFuelConsumptionById($id: Int!) {delete_vehicle_fuel_consumption_by_id(id:$id)}`;
map<anydata> variables = {"id": id};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
map<json> responseMap = <map<json>>graphqlResponse;
json responseData = responseMap.get("data");
json|error row_count = check responseData.delete_vehicle_fuel_consumption_by_id;
return row_count;
}
remote isolated function getVehicleFuelConsumptionByDate(string date, int organization_id) returns GetVehicleFuelConsumptionByDateResponse|graphql:ClientError {
string query = string `query getVehicleFuelConsumptionByDate($organization_id:Int!,$date:String!) {vehicle_fuel_consumption_by_date(organization_id:$organization_id,date:$date) {id vehicle {id vehicle_number} date_time reason {id reason} starting_meter ending_meter distance comment created updated}}`;
map<anydata> variables = {"date": date, "organization_id": organization_id};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetVehicleFuelConsumptionByDateResponse>check performDataBinding(graphqlResponse, GetVehicleFuelConsumptionByDateResponse);
}
remote isolated function getVehicleFuelConsumptionById(int id) returns GetVehicleFuelConsumptionByIdResponse|graphql:ClientError {
string query = string `query getVehicleFuelConsumptionById($id:Int!) {vehicle_fuel_consumption_by_id(id:$id) {id vehicle {id vehicle_number} date_time reason {id reason} starting_meter ending_meter distance comment created updated}}`;
map<anydata> variables = {"id": id};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetVehicleFuelConsumptionByIdResponse>check performDataBinding(graphqlResponse, GetVehicleFuelConsumptionByIdResponse);
}
remote isolated function getVehicles(int organization_id) returns GetVehiclesResponse|graphql:ClientError {
string query = string `query getVehicles($organization_id:Int!) {vehicles(organization_id:$organization_id) {id vehicle_number person {id preferred_name digital_id}}}`;
map<anydata> variables = {"organization_id": organization_id};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetVehiclesResponse>check performDataBinding(graphqlResponse, GetVehiclesResponse);
}
remote isolated function getVehicleReasons() returns GetVehicleReasonsResponse|graphql:ClientError {
string query = string `query getVehicleReasons {vehicle_reasons {id reason}}`;
map<anydata> variables = {};
json graphqlResponse = check self.graphqlClient->executeWithType(query, variables);
return <GetVehicleReasonsResponse>check performDataBinding(graphqlResponse, GetVehicleReasonsResponse);
}

}
134 changes: 133 additions & 1 deletion campus/bffs/asset/api/service.bal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ballerina/http;
import ballerina/graphql;
import ballerina/http;
import ballerina/log;

public function initClientConfig() returns ConnectionConfig {
Expand Down Expand Up @@ -883,4 +883,136 @@ service / on new http:Listener(9094) {
":: Detail: " + getConsumableYearlyReportResponse.detail().toString());
}
}

resource function post add_vehicle_fuel_consumption(@http:Payload VehicleFuelConsumption vehicleFuelConsumption) returns VehicleFuelConsumption|error {
AddVehicleFuelConsumptionResponse|graphql:ClientError addVehicleFuelConsumption = globalDataClient->addVehicleFuelConsumption(vehicleFuelConsumption);
if (addVehicleFuelConsumption is AddVehicleFuelConsumptionResponse) {
VehicleFuelConsumption|error vehicle_fuel_consumption_record = addVehicleFuelConsumption.add_vehicle_fuel_consumption.cloneWithType(VehicleFuelConsumption);
if (vehicle_fuel_consumption_record is VehicleFuelConsumption) {
return vehicle_fuel_consumption_record;
} else {
log:printError("Error while processing Application record received", vehicle_fuel_consumption_record);
return error("Error while processing Application record received: " + vehicle_fuel_consumption_record.message() +
":: Detail: " + vehicle_fuel_consumption_record.detail().toString());
}
} else {
log:printError("Error while creating application", addVehicleFuelConsumption);
return error("Error while creating application: " + addVehicleFuelConsumption.message() +
":: Detail: " + addVehicleFuelConsumption.detail().toString());
}
}

resource function get vehicle_fuel_consumption_by_date/[int organization_id]/[string date]() returns VehicleFuelConsumption[]|error {
GetVehicleFuelConsumptionByDateResponse|graphql:ClientError getVehicleFuelConsumptionByDateResponse = globalDataClient->getVehicleFuelConsumptionByDate(date, organization_id);
if (getVehicleFuelConsumptionByDateResponse is GetVehicleFuelConsumptionByDateResponse) {
VehicleFuelConsumption[] vehicle_fuel_consumption_by_date_datas = [];
foreach var vehicle_fuel_consumption_by_data in getVehicleFuelConsumptionByDateResponse.vehicle_fuel_consumption_by_date {
VehicleFuelConsumption|error vehicle_fuel_consumption_by_data_record = vehicle_fuel_consumption_by_data.cloneWithType(VehicleFuelConsumption);
if (vehicle_fuel_consumption_by_data_record is VehicleFuelConsumption) {
vehicle_fuel_consumption_by_date_datas.push(vehicle_fuel_consumption_by_data_record);
} else {
log:printError("Error while processing Application record received", vehicle_fuel_consumption_by_data_record);
return error("Error while processing Application record received: " + vehicle_fuel_consumption_by_data_record.message() +
":: Detail: " + vehicle_fuel_consumption_by_data_record.detail().toString());
}
}

return vehicle_fuel_consumption_by_date_datas;

} else {
log:printError("Error while getting application", getVehicleFuelConsumptionByDateResponse);
return error("Error while getting application: " + getVehicleFuelConsumptionByDateResponse.message() +
":: Detail: " + getVehicleFuelConsumptionByDateResponse.detail().toString());
}
}
resource function get vehicle_fuel_consumption_by_id/[int id]() returns VehicleFuelConsumption|error {
GetVehicleFuelConsumptionByIdResponse|graphql:ClientError getVehicleFuelConsumptionByIdResponse = globalDataClient->getVehicleFuelConsumptionById(id);
if (getVehicleFuelConsumptionByIdResponse is GetVehicleFuelConsumptionByIdResponse) {
VehicleFuelConsumption|error vehicle_fuel_consumption_by_id_record = getVehicleFuelConsumptionByIdResponse.vehicle_fuel_consumption_by_id.cloneWithType(VehicleFuelConsumption);
if (vehicle_fuel_consumption_by_id_record is VehicleFuelConsumption) {
return vehicle_fuel_consumption_by_id_record;
} else {
log:printError("Error while processing Application record received", vehicle_fuel_consumption_by_id_record);
return error("Error while processing Application record received: " + vehicle_fuel_consumption_by_id_record.message() +
":: Detail: " + vehicle_fuel_consumption_by_id_record.detail().toString());
}
} else {
log:printError("Error while creating application", getVehicleFuelConsumptionByIdResponse);
return error("Error while creating application: " + getVehicleFuelConsumptionByIdResponse.message() +
":: Detail: " + getVehicleFuelConsumptionByIdResponse.detail().toString());
}
}

resource function put update_vehicle_fuel_consumption(@http:Payload VehicleFuelConsumption vehicleFuelConsumption) returns VehicleFuelConsumption|error {
UpdateVehicleFuelConsumptionResponse|graphql:ClientError updateVehicleFuelConsumptionResponse = globalDataClient->updateVehicleFuelConsumption(vehicleFuelConsumption);
if (updateVehicleFuelConsumptionResponse is UpdateVehicleFuelConsumptionResponse) {
VehicleFuelConsumption|error vehicle_fuel_consumption_record = updateVehicleFuelConsumptionResponse.update_vehicle_fuel_consumption.cloneWithType(VehicleFuelConsumption);
if (vehicle_fuel_consumption_record is VehicleFuelConsumption) {
return vehicle_fuel_consumption_record;
}
else {
return error("Error while processing Application record received: " + vehicle_fuel_consumption_record.message() +
":: Detail: " + vehicle_fuel_consumption_record.detail().toString());
}
} else {
log:printError("Error while creating evaluation", updateVehicleFuelConsumptionResponse);
return error("Error while creating evaluation: " + updateVehicleFuelConsumptionResponse.message() +
":: Detail: " + updateVehicleFuelConsumptionResponse.detail().toString());
}
}

resource function delete vehicle_fuel_consumption_by_id/[int id]() returns json|error {
json|error delete_count = globalDataClient->deleteVehicleFuelConsumptionById(id);
return delete_count;
}


resource function get vehicles/[int organization_id]() returns Vehicle[]|error {
GetVehiclesResponse|graphql:ClientError getVehiclesResponse= globalDataClient->getVehicles(organization_id);
if (getVehiclesResponse is GetVehiclesResponse) {
Vehicle[] vehicle_datas = [];
foreach var vehicle_data in getVehiclesResponse.vehicles {
Vehicle|error vehicle_data_record = vehicle_data.cloneWithType(Vehicle);
if (vehicle_data_record is Vehicle) {
vehicle_datas.push(vehicle_data_record);
} else {
log:printError("Error while processing Application record received", vehicle_data_record);
return error("Error while processing Application record received: " + vehicle_data_record.message() +
":: Detail: " + vehicle_data_record.detail().toString());
}
}

return vehicle_datas;

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

resource function get vehicle_reasons() returns VehicleReasonMetadata[]|error {
GetVehicleReasonsResponse|graphql:ClientError getVehicleReasonsResponse = globalDataClient->getVehicleReasons();
if(getVehicleReasonsResponse is GetVehicleReasonsResponse) {
VehicleReasonMetadata[] vehicleReasonsMetaData = [];
foreach var vehicle_reason in getVehicleReasonsResponse.vehicle_reasons {
VehicleReasonMetadata|error vehicleReasonMetaData = vehicle_reason.cloneWithType(VehicleReasonMetadata);
if(vehicleReasonMetaData is VehicleReasonMetadata) {
vehicleReasonsMetaData.push(vehicleReasonMetaData);
} else {
log:printError("Error while processing Application record received", vehicleReasonMetaData);
return error("Error while processing Application record received: " + vehicleReasonMetaData.message() +
":: Detail: " + vehicleReasonMetaData.detail().toString());
}
}

return vehicleReasonsMetaData;

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

}
127 changes: 125 additions & 2 deletions campus/bffs/asset/api/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ public type Inventory record {
int? person_id?;
};


public type Organization record {
int[]? parent_organizations?;
string? notes?;
Expand Down Expand Up @@ -395,6 +394,37 @@ public type Vacancy record {
string? record_type?;
};

public type Vehicle record {
string? record_type?;
int? id?;
string? vehicle_number?;
int? organization_id?;
int? person_id?;
string? created?;
string? updated?;
};

public type VehicleReasonMetadata record {
string? record_type?;
int? id?;
string? reason?;
string? created?;
};

public type VehicleFuelConsumption record {
string? date_time?;
string? distance?;
string? starting_meter?;
string? created?;
string? ending_meter?;
string? comment?;
int? id?;
int? vehicle_id?;
string? updated?;
string? record_type?;
int? reason_id?;
};

public type WorkExperience record {
string? end_date?;
int[]? evaluation_id?;
Expand Down Expand Up @@ -1171,4 +1201,97 @@ public type GetConsumableYearlyReportResponse record {|
string? value;
|}? resource_property;
|}[] consumable_yearly_report;
|};
|};

public type AddVehicleFuelConsumptionResponse record {|
map<json?> __extensions?;
record {|
int? id;
int? vehicle_id;
string? date_time;
int? reason_id;
string? starting_meter;
string? ending_meter;
string? distance;
string? comment;
|}? add_vehicle_fuel_consumption;
|};

public type UpdateVehicleFuelConsumptionResponse record {|
map<json?> __extensions?;
record {|
int? id;
int? vehicle_id;
string? date_time;
int? reason_id;
string? starting_meter;
string? ending_meter;
string? distance;
string? comment;
|}? update_vehicle_fuel_consumption;
|};

public type GetVehicleFuelConsumptionByDateResponse record {|
map<json?> __extensions?;
record {|
int? id;
record {|
int? id;
string? vehicle_number;
|}? vehicle;
string? date_time;
record {|
int? id;
string? reason;
|}? reason;
string? starting_meter;
string? ending_meter;
string? distance;
string? comment;
string? created;
string? updated;
|}[] vehicle_fuel_consumption_by_date;
|};

public type GetVehicleFuelConsumptionByIdResponse record {|
map<json?> __extensions?;
record {|
int? id;
record {|
int? id;
string? vehicle_number;
|}? vehicle;
string? date_time;
record {|
int? id;
string? reason;
|}? reason;
string? starting_meter;
string? ending_meter;
string? distance;
string? comment;
string? created;
string? updated;
|}? vehicle_fuel_consumption_by_id;
|};

public type GetVehiclesResponse record {|
map<json?> __extensions?;
record {|
int? id;
string? vehicle_number;
record {|
int? id;
string? preferred_name;
string? digital_id;
|}? person;
|}[] vehicles;
|};

public type GetVehicleReasonsResponse record {|
map<json?> __extensions?;
record {|
int? id;
string? reason;
|}[] vehicle_reasons;
|};
Loading
Loading