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

Chore/349 autofill dependent fuel fields #2214

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions bc_obps/reporting/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
from .build_form_schema import build_form_schema
from .operations import get_dashboard_operations_list
from .activity_data import get_initial_activity_data
from .fuel import get_fuel_data
26 changes: 26 additions & 0 deletions bc_obps/reporting/api/fuel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from service.data_access_service.fuel_service import FuelTypeDataAccessService
from .router import router
from registration.decorators import handle_http_errors
from django.http import HttpRequest
from typing import Tuple
from reporting.models import FuelType
from reporting.schema.fuel import FuelTypeSchema

from registration.schema.generic import Message
from ninja.responses import codes_4xx, codes_5xx


##### GET #####


@router.get(
"/fuel",
response={200: FuelTypeSchema, codes_4xx: Message, codes_5xx: Message},
url_name="fuel",
)
@handle_http_errors()
def get_fuel_data(
request: HttpRequest,
fuel_name: str,
) -> Tuple[int, FuelType]:
return 200, FuelTypeDataAccessService.get_fuel(fuel_name)
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,27 @@
"items": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string"
"fuelType": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string",
"readOnly": true
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string",
"readOnly": true
}
}
},
"fuelDescription": {
"title": "Fuel Description",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,27 @@
"items": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string"
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string"
"fuelType": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string",
"readOnly": true
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string",
"readOnly": true
}
}
},
"annualFuelAmount": {
"title": "Annual Fuel Amount",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,27 @@
"items": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string"
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string"
"fuelType": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string",
"readOnly": true
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string",
"readOnly": true
}
}
},
"annualFuelAmount": {
"title": "Annual Fuel Amount",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,27 @@
"items": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string"
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string"
"fuelType": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string",
"readOnly": true
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string",
"readOnly": true
}
}
},
"annualFuelAmount": {
"title": "Annual Fuel Amount",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,27 @@
"items": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string"
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string"
"fuelType": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string",
"readOnly": true
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string",
"readOnly": true
}
}
},
"annualFuelAmount": {
"title": "Annual Fuel Amount",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,27 @@
"items": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string"
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string"
"fuelType": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string",
"readOnly": true
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string",
"readOnly": true
}
}
},
"annualFuelAmount": {
"title": "Annual Fuel Amount",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,27 @@
"items": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string"
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string"
"fuelType": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string",
"readOnly": true
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string",
"readOnly": true
}
}
},
"annualFuelAmount": {
"title": "Annual Fuel Amount",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,27 @@
"items": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string"
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string"
"fuelType": {
"type": "object",
"properties": {
"fuelName": {
"title": "Fuel Name",
"type": "string",
"enum": []
},
"fuelClassification": {
"title": "Fuel Classification",
"maxLength": 200,
"type": "string",
"readOnly": true
},
"fuelUnit": {
"title": "Fuel Unit",
"maxLength": 200,
"type": "string",
"readOnly": true
}
}
},
"annualFuelAmount": {
"title": "Annual Fuel Amount",
Expand Down
Loading
Loading