From e1947ce92fde6960cc0bd2d88949b372c74621b1 Mon Sep 17 00:00:00 2001 From: lahirulakruwan Date: Wed, 4 Sep 2024 14:47:46 +0530 Subject: [PATCH] Vehicle fuel consumption bff changes added --- campus/bffs/asset/api/client.bal | 48 ++ campus/bffs/asset/api/service.bal | 43 ++ campus/bffs/asset/api/types.bal | 109 ++- .../bffs/asset/graphql_client/asset.graphql | 89 ++- .../graphql_client_cg_src/client.bal | 36 + .../graphql_client_cg_src/config_types.bal | 1 - .../graphql_client_cg_src/types.bal | 107 +++ .../bffs/asset/graphql_client/schema.graphql | 118 ++- campus/bffs/asset/graphql_client/schema.json | 711 ++++++++++++++++-- 9 files changed, 1150 insertions(+), 112 deletions(-) diff --git a/campus/bffs/asset/api/client.bal b/campus/bffs/asset/api/client.bal index 8a257c8b..25a4ac63 100644 --- a/campus/bffs/asset/api/client.bal +++ b/campus/bffs/asset/api/client.bal @@ -379,4 +379,52 @@ public isolated client class GraphqlClient { json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); return 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 variables = {"vehicleFuelConsumption": vehicleFuelConsumption}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return 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 variables = {"vehicleFuelConsumption": vehicleFuelConsumption}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return 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 variables = {"id": id}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + map responseMap = >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 variables = {"date": date, "organization_id": organization_id}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return 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 variables = {"id": id}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return 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 variables = {"organization_id": organization_id}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return check performDataBinding(graphqlResponse, GetVehiclesResponse); + } + remote isolated function getVehicleReasons() returns GetVehicleReasonsResponse|graphql:ClientError { + string query = string `query getVehicleReasons {vehicle_reasons {id reason}}`; + map variables = {}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return check performDataBinding(graphqlResponse, GetVehicleReasonsResponse); + } + } diff --git a/campus/bffs/asset/api/service.bal b/campus/bffs/asset/api/service.bal index e63dd1ce..283cee5b 100644 --- a/campus/bffs/asset/api/service.bal +++ b/campus/bffs/asset/api/service.bal @@ -883,4 +883,47 @@ 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()); + } + } + } diff --git a/campus/bffs/asset/api/types.bal b/campus/bffs/asset/api/types.bal index 7ae63654..0dfb5d44 100644 --- a/campus/bffs/asset/api/types.bal +++ b/campus/bffs/asset/api/types.bal @@ -395,6 +395,20 @@ public type Vacancy record { string? record_type?; }; +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?; @@ -1171,4 +1185,97 @@ public type GetConsumableYearlyReportResponse record {| string? value; |}? resource_property; |}[] consumable_yearly_report; -|}; \ No newline at end of file +|}; + +public type AddVehicleFuelConsumptionResponse record {| + map __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 __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 __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 __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 __extensions?; + record {| + int? id; + string? vehicle_number; + record {| + int? id; + string? preferred_name; + string? digital_id; + |}? person; + |}[]? vehicles; +|}; + +public type GetVehicleReasonsResponse record {| + map __extensions?; + record {| + int? id; + string? reason; + |}[]? vehicle_reasons; +|}; diff --git a/campus/bffs/asset/graphql_client/asset.graphql b/campus/bffs/asset/graphql_client/asset.graphql index 54bd555c..97aa3328 100644 --- a/campus/bffs/asset/graphql_client/asset.graphql +++ b/campus/bffs/asset/graphql_client/asset.graphql @@ -726,4 +726,91 @@ query getConsumableYearlyReport($organization_id: Int!,$consumable_id: Int!,$yea value } } -} \ No newline at end of file +} + +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 + } +} + +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 + } +} + +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 + } +} + +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 + } +} + +query getVehicles($organization_id: Int!) { + vehicles(organization_id: $organization_id) { + id + vehicle_number + person{ + id + preferred_name + digital_id + } + } +} + +query getVehicleReasons { + vehicle_reasons { + id + reason + } +} diff --git a/campus/bffs/asset/graphql_client/graphql_client_cg_src/client.bal b/campus/bffs/asset/graphql_client/graphql_client_cg_src/client.bal index e406b948..c087d4c4 100644 --- a/campus/bffs/asset/graphql_client/graphql_client_cg_src/client.bal +++ b/campus/bffs/asset/graphql_client/graphql_client_cg_src/client.bal @@ -255,4 +255,40 @@ public isolated client class GraphqlClient { json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); return 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 variables = {"vehicleFuelConsumption": vehicleFuelConsumption}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return 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 variables = {"vehicleFuelConsumption": vehicleFuelConsumption}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return check performDataBinding(graphqlResponse, UpdateVehicleFuelConsumptionResponse); + } + 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 variables = {"date": date, "organization_id": organization_id}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return 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 variables = {"id": id}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return 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 variables = {"organization_id": organization_id}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return check performDataBinding(graphqlResponse, GetVehiclesResponse); + } + remote isolated function getVehicleReasons() returns GetVehicleReasonsResponse|graphql:ClientError { + string query = string `query getVehicleReasons {vehicle_reasons {id reason}}`; + map variables = {}; + json graphqlResponse = check self.graphqlClient->executeWithType(query, variables); + return check performDataBinding(graphqlResponse, GetVehicleReasonsResponse); + } } diff --git a/campus/bffs/asset/graphql_client/graphql_client_cg_src/config_types.bal b/campus/bffs/asset/graphql_client/graphql_client_cg_src/config_types.bal index 6b2e15db..ddeee9c9 100644 --- a/campus/bffs/asset/graphql_client/graphql_client_cg_src/config_types.bal +++ b/campus/bffs/asset/graphql_client/graphql_client_cg_src/config_types.bal @@ -13,7 +13,6 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. - import ballerina/graphql; # Client configuration details. diff --git a/campus/bffs/asset/graphql_client/graphql_client_cg_src/types.bal b/campus/bffs/asset/graphql_client/graphql_client_cg_src/types.bal index 2191c623..044e42e2 100644 --- a/campus/bffs/asset/graphql_client/graphql_client_cg_src/types.bal +++ b/campus/bffs/asset/graphql_client/graphql_client_cg_src/types.bal @@ -401,6 +401,20 @@ public type Vacancy record { string? record_type?; }; +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?; @@ -1178,3 +1192,96 @@ public type GetConsumableYearlyReportResponse record {| |}? resource_property; |}[]? consumable_yearly_report; |}; + +public type AddVehicleFuelConsumptionResponse record {| + map __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 __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 __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 __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 __extensions?; + record {| + int? id; + string? vehicle_number; + record {| + int? id; + string? preferred_name; + string? digital_id; + |}? person; + |}[]? vehicles; +|}; + +public type GetVehicleReasonsResponse record {| + map __extensions?; + record {| + int? id; + string? reason; + |}[]? vehicle_reasons; +|}; diff --git a/campus/bffs/asset/graphql_client/schema.graphql b/campus/bffs/asset/graphql_client/schema.graphql index 3dcfb4e1..8242fab4 100644 --- a/campus/bffs/asset/graphql_client/schema.graphql +++ b/campus/bffs/asset/graphql_client/schema.graphql @@ -1,5 +1,5 @@ input Activity { - record_type: String = "" + record_type: String = "activity" id: Int name: String description: String @@ -24,7 +24,7 @@ type ActivityData { } input ActivityInstance { - record_type: String = "" + record_type: String = "activity_instance" id: Int activity_id: Int name: String @@ -62,7 +62,7 @@ type ActivityInstanceData { } input ActivityParticipant { - record_type: String = "" + record_type: String = "activity_participant" id: Int activity_instance_id: Int person_id: Int @@ -76,7 +76,7 @@ input ActivityParticipant { } input ActivityParticipantAttendance { - record_type: String = "" + record_type: String = "activity_participant_attendance" id: Int person_id: Int activity_instance_id: Int @@ -138,7 +138,7 @@ type ActivityParticipantData { } input ActivitySequencePlan { - record_type: String = "" + record_type: String = "activity_sequence_plan" id: Int activity_id: Int sequence_number: Int @@ -161,7 +161,7 @@ type ActivitySequencePlanData { } input Address { - record_type: String = "" + record_type: String = "address" id: Int street_address: String! phone: Int @@ -179,7 +179,7 @@ type AddressData { } input ApplicantConsent { - record_type: String = "" + record_type: String = "applicant_consent" id: Int active: Boolean organization_id: Int @@ -225,7 +225,7 @@ type ApplicantConsentData { } input Application { - record_type: String = "" + record_type: String = "application" id: Int person_id: Int vacancy_id: Int @@ -248,7 +248,7 @@ type ApplicationStatusData { } input Asset { - record_type: String = "" + record_type: String = "asset" id: Int name: String manufacturer: String @@ -290,7 +290,7 @@ type AttendanceDashboardDataMain { } input AvinyaType { - record_type: String = "" + record_type: String = "avinya_type" id: Int active: Boolean! global_type: String! @@ -319,7 +319,7 @@ type CityData { } input Consumable { - record_type: String = "" + record_type: String = "consumable" id: Int avinya_type_id: Int name: String @@ -372,7 +372,7 @@ type DistrictData { } input DutyParticipant { - record_type: String = "" + record_type: String = "duty_participant" id: Int activity_id: Int activity: Activity @@ -402,7 +402,7 @@ type DutyRotationMetaData { } input DutyRotationMetaDetails { - record_type: String = "" + record_type: String = "duty_rotation_metadata" id: Int start_date: String end_date: String @@ -410,7 +410,7 @@ input DutyRotationMetaDetails { } input EducationExperience { - record_type: String = "" + record_type: String = "education_experience" id: Int person_id: Int school: String @@ -428,7 +428,7 @@ type EducationExperienceData { } input Evaluation { - record_type: String = "" + record_type: String = "evaluation" id: Int evaluatee_id: Int evaluator_id: Int @@ -444,7 +444,7 @@ input Evaluation { } input EvaluationCriteria { - record_type: String = "" + record_type: String = "evaluation_criteria" id: Int prompt: String description: String @@ -455,7 +455,7 @@ input EvaluationCriteria { } input EvaluationCriteriaAnswerOption { - record_type: String = "" + record_type: String = "evaluation_criteria_answer_option" id: Int evaluation_criteria_id: Int answer: String @@ -480,7 +480,7 @@ type EvaluationCriteriaData { } input EvaluationCycle { - record_type: String = "" + record_type: String = "evaluation_cycle" id: Int name: String description: String @@ -511,7 +511,7 @@ type EvaluationData { } input EvaluationMetadata { - record_type: String = "" + record_type: String = "metadata" id: Int evaluation_id: Int location: String @@ -543,7 +543,7 @@ type GeoData { } input Inventory { - record_type: String = "" + record_type: String = "inventory" id: Int avinya_type_id: Int asset_id: Int @@ -652,10 +652,13 @@ type Mutation { consumable_depletion(person_id: Int!, organization_id: Int!, date: String!, inventories: [Inventory!]!): [InventoryData!] update_consumable_replenishment(inventories: [Inventory!]!): [InventoryData!] update_consumable_depletion(inventories: [Inventory!]!): [InventoryData!] + add_vehicle_fuel_consumption(vehicle_fuel_consumption: VehicleFuelConsumption!): VehicleFuelConsumptionData + update_vehicle_fuel_consumption(vehicle_fuel_consumption: VehicleFuelConsumption!): VehicleFuelConsumptionData + delete_vehicle_fuel_consumption_by_id(id: Int): Int } input Organization { - record_type: String = "" + record_type: String = "organization" id: Int child_organizations: [Int!] parent_organizations: [Int!] @@ -698,7 +701,7 @@ type OrganizationStructureData { } input Person { - record_type: String = "" + record_type: String = "person" id: Int preferred_name: String full_name: String @@ -789,7 +792,7 @@ type PlaceData { } input Prospect { - record_type: String = "" + record_type: String = "prospect" id: Int active: Boolean name: String @@ -866,12 +869,12 @@ type Query { education_experience_byPerson(person_id: Int): [EducationExperienceData!]! work_experience(id: Int): WorkExperienceData work_experience_ByPerson(person_id: Int): [WorkExperienceData!] - activity(name: String, id: Int): ActivityData + activity(name: String, id: Int = 0): ActivityData class_attendance_today(organization_id: Int, activity_id: Int): [ActivityParticipantAttendanceData!] person_attendance_today(person_id: Int, activity_id: Int): [ActivityParticipantAttendanceData!] - person_attendance_report(person_id: Int, activity_id: Int, result_limit: Int): [ActivityParticipantAttendanceData!] - class_attendance_report(organization_id: Int, parent_organization_id: Int, activity_id: Int, result_limit: Int, from_date: String = "", to_date: String = ""): [ActivityParticipantAttendanceData!] - late_attendance_report(organization_id: Int, parent_organization_id: Int, activity_id: Int, result_limit: Int, from_date: String = "", to_date: String = ""): [ActivityParticipantAttendanceDataForLateAttendance!] + person_attendance_report(person_id: Int, activity_id: Int, result_limit: Int = 0): [ActivityParticipantAttendanceData!] + class_attendance_report(organization_id: Int, parent_organization_id: Int, activity_id: Int, result_limit: Int = 0, from_date: String = "", to_date: String = ""): [ActivityParticipantAttendanceData!] + late_attendance_report(organization_id: Int, parent_organization_id: Int, activity_id: Int, result_limit: Int = 0, from_date: String = "", to_date: String = ""): [ActivityParticipantAttendanceDataForLateAttendance!] asset(id: Int, avinya_type_id: Int): [AssetData!] assets: [AssetData!]! supplier(id: Int!): SupplierData @@ -906,10 +909,14 @@ type Query { consumable_weekly_report(organization_id: Int, from_date: String = "", to_date: String = ""): [InventoryData!] consumable_monthly_report(organization_id: Int, year: Int, month: Int): [InventoryData!] consumable_yearly_report(organization_id: Int, consumable_id: Int, year: Int): [InventoryData!] + vehicle_fuel_consumption_by_date(organization_id: Int, date: String = ""): [VehicleFuelConsumptionData!] + vehicle_fuel_consumption_by_id(id: Int): VehicleFuelConsumptionData + vehicles(organization_id: Int): [VehicleData!] + vehicle_reasons: [VehicleReasonMetaData!] } input ResourceAllocation { - record_type: String = "" + record_type: String = "resource_allocation" id: Int requested: Boolean approved: Boolean @@ -944,7 +951,7 @@ type ResourceAllocationData { } input ResourceProperty { - record_type: String = "" + record_type: String = "resource_property" id: Int asset_id: Int consumable_id: Int @@ -961,7 +968,7 @@ type ResourcePropertyData { } input Supplier { - record_type: String = "" + record_type: String = "supplier" id: Int name: String description: String @@ -984,7 +991,7 @@ type SupplierData { } input Supply { - record_type: String = "" + record_type: String = "supply" id: Int asset_id: Int consumable_id: Int @@ -1018,7 +1025,7 @@ type TotalActivityParticipantAttendanceCountByDateData { } input Vacancy { - record_type: String = "" + record_type: String = "vacancy" id: Int name: String description: String @@ -1037,8 +1044,53 @@ type VacancyData { evaluation_criteria: [EvaluationCriteriaData!] } +type VehicleData { + id: Int + vehicle_number: String + organization: OrganizationData + person_id: Int + person: PersonData + created: String + updated: String +} + +input VehicleFuelConsumption { + record_type: String = "vehicle_fuel_consumption" + id: Int + vehicle_id: Int + date_time: String + reason_id: Int + starting_meter: String + ending_meter: String + distance: String + comment: String + created: String + updated: String +} + +type VehicleFuelConsumptionData { + id: Int + vehicle_id: Int + vehicle: VehicleData + date_time: String + reason_id: Int + reason: VehicleReasonMetaData + starting_meter: String + ending_meter: String + distance: String + comment: String + created: String + updated: String +} + +type VehicleReasonMetaData { + id: Int + reason: String + created: String +} + input WorkExperience { - record_type: String = "" + record_type: String = "work_experience" id: Int person_id: Int organization: String diff --git a/campus/bffs/asset/graphql_client/schema.json b/campus/bffs/asset/graphql_client/schema.json index d86212c2..1b60790c 100644 --- a/campus/bffs/asset/graphql_client/schema.json +++ b/campus/bffs/asset/graphql_client/schema.json @@ -463,7 +463,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"activity_sequence_plan\"" }, { "name": "id", @@ -1535,7 +1535,7 @@ "name": "Int", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "0" } ], "type": { @@ -1650,7 +1650,7 @@ "name": "Int", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "0" } ], "type": { @@ -1706,7 +1706,7 @@ "name": "Int", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "0" }, { "name": "from_date", @@ -1780,7 +1780,7 @@ "name": "Int", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "0" }, { "name": "from_date", @@ -2954,6 +2954,113 @@ }, "isDeprecated": false, "deprecationReason": null + }, + { + "name": "vehicle_fuel_consumption_by_date", + "args": [ + { + "name": "organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "date", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"\"" + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "VehicleFuelConsumptionData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "vehicle_fuel_consumption_by_id", + "args": [ + { + "name": "id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "VehicleFuelConsumptionData", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "vehicles", + "args": [ + { + "name": "organization_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "VehicleData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "vehicle_reasons", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "VehicleReasonMetaData", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null } ], "inputFields": null, @@ -2973,7 +3080,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"address\"" }, { "name": "id", @@ -3067,7 +3174,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"activity_instance\"" }, { "name": "id", @@ -3328,7 +3435,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"evaluation_criteria_answer_option\"" }, { "name": "id", @@ -3383,7 +3490,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"activity\"" }, { "name": "id", @@ -3998,7 +4105,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"applicant_consent\"" }, { "name": "id", @@ -4206,7 +4313,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"duty_rotation_metadata\"" }, { "name": "id", @@ -4261,7 +4368,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"activity_participant\"" }, { "name": "id", @@ -4770,7 +4877,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"asset\"" }, { "name": "id", @@ -5083,7 +5190,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"evaluation\"" }, { "name": "id", @@ -5226,7 +5333,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"metadata\"" }, { "name": "id", @@ -5845,7 +5952,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"vacancy\"" }, { "name": "id", @@ -6074,6 +6181,93 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "VehicleData", + "fields": [ + { + "name": "id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "vehicle_number", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organization", + "args": [], + "type": { + "kind": "OBJECT", + "name": "OrganizationData", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "person_id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "person", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PersonData", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "created", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updated", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "InventoryData", @@ -8406,66 +8600,246 @@ }, "isDeprecated": false, "deprecationReason": null - } - ], - "inputFields": null, - "interfaces": [], - "enumValues": null, - "possibleTypes": null - }, - { - "kind": "OBJECT", - "name": "ProvinceData", - "fields": [ - { - "name": "id", - "args": [], - "type": { - "kind": "SCALAR", - "name": "Int", - "ofType": null - }, - "isDeprecated": false, - "deprecationReason": null }, { - "name": "name", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "OBJECT", - "name": "LocalizedName", - "ofType": null + "name": "add_vehicle_fuel_consumption", + "args": [ + { + "name": "vehicle_fuel_consumption", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "VehicleFuelConsumption", + "ofType": null + } + }, + "defaultValue": null } + ], + "type": { + "kind": "OBJECT", + "name": "VehicleFuelConsumptionData", + "ofType": null }, "isDeprecated": false, "deprecationReason": null }, { - "name": "districts", - "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { - "kind": "LIST", - "name": null, - "ofType": { + "name": "update_vehicle_fuel_consumption", + "args": [ + { + "name": "vehicle_fuel_consumption", + "type": { "kind": "NON_NULL", "name": null, "ofType": { - "kind": "OBJECT", - "name": "DistrictData", + "kind": "INPUT_OBJECT", + "name": "VehicleFuelConsumption", "ofType": null } - } + }, + "defaultValue": null } + ], + "type": { + "kind": "OBJECT", + "name": "VehicleFuelConsumptionData", + "ofType": null }, "isDeprecated": false, "deprecationReason": null - } + }, + { + "name": "delete_vehicle_fuel_consumption_by_id", + "args": [ + { + "name": "id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "VehicleFuelConsumption", + "fields": null, + "inputFields": [ + { + "name": "record_type", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"vehicle_fuel_consumption\"" + }, + { + "name": "id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "vehicle_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "date_time", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "reason_id", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "starting_meter", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "ending_meter", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "distance", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "comment", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "created", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "updated", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProvinceData", + "fields": [ + { + "name": "id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "LocalizedName", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "districts", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "DistrictData", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } ], "inputFields": null, "interfaces": [], @@ -8592,7 +8966,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"person\"" }, { "name": "id", @@ -8933,7 +9307,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"application\"" }, { "name": "id", @@ -8988,7 +9362,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"inventory\"" }, { "name": "id", @@ -9178,7 +9552,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"activity_participant_attendance\"" }, { "name": "id", @@ -9426,7 +9800,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"organization\"" }, { "name": "id", @@ -9581,7 +9955,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"education_experience\"" }, { "name": "id", @@ -9954,7 +10328,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"supply\"" }, { "name": "id", @@ -10133,6 +10507,49 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "VehicleReasonMetaData", + "fields": [ + { + "name": "id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reason", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "created", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "AssetData", @@ -10417,6 +10834,148 @@ "enumValues": null, "possibleTypes": null }, + { + "kind": "OBJECT", + "name": "VehicleFuelConsumptionData", + "fields": [ + { + "name": "id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "vehicle_id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "vehicle", + "args": [], + "type": { + "kind": "OBJECT", + "name": "VehicleData", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "date_time", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reason_id", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reason", + "args": [], + "type": { + "kind": "OBJECT", + "name": "VehicleReasonMetaData", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "starting_meter", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ending_meter", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "distance", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "comment", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "created", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updated", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, { "kind": "OBJECT", "name": "CityData", @@ -10489,7 +11048,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"resource_allocation\"" }, { "name": "id", @@ -10923,7 +11482,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"supplier\"" }, { "name": "id", @@ -11384,7 +11943,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"work_experience\"" }, { "name": "id", @@ -11565,7 +12124,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"consumable\"" }, { "name": "id", @@ -12029,7 +12588,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"evaluation_criteria\"" }, { "name": "id", @@ -12111,7 +12670,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"avinya_type\"" }, { "name": "id", @@ -12264,7 +12823,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"resource_property\"" }, { "name": "id", @@ -12360,7 +12919,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"evaluation_cycle\"" }, { "name": "id", @@ -12679,7 +13238,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"prospect\"" }, { "name": "id", @@ -12913,7 +13472,7 @@ "name": "String", "ofType": null }, - "defaultValue": "\"\"" + "defaultValue": "\"duty_participant\"" }, { "name": "id",