-
Notifications
You must be signed in to change notification settings - Fork 39
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
editoast: add endpoint to check if locations exist #8953
base: dev
Are you sure you want to change the base?
Conversation
Signed-off-by: hamz2a <[email protected]>
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## dev #8953 +/- ##
============================================
+ Coverage 37.12% 37.23% +0.10%
Complexity 2211 2211
============================================
Files 1260 1260
Lines 115109 115335 +226
Branches 3230 3230
============================================
+ Hits 42738 42948 +210
- Misses 70438 70454 +16
Partials 1933 1933
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First round of review. This new endpoint should share code with the PF one. Check my comments bellow.
crate::routes! { | ||
"/objects/{object_type}" => get_objects, | ||
"/check-locations" => check_locations, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename the endpoint since what it really does is returning path steps coordinates.
pub fn from_railjson(railjson: serde_json::Value) -> Result<Self, ParseError> { | ||
serde_json::from_value(railjson).map_err(ParseError::from) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not letting diesel deserialize to OP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have something that transform a list of PathStep
into a Vec<Vec<TrackOffset>>
. This also checked that all path steps are valids.
It's important that this logic is shared between both endpoints.
Important
Small changes are required. This function raise an error when it encounter the first invalid path step.
It should instead continue and list all valids/invalid.
closes #8636