-
Notifications
You must be signed in to change notification settings - Fork 1
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
111 clean services #113
111 clean services #113
Conversation
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.
Looks good to me. It essentially is what it says by removing all unnecessary service methods, most of which are just delegating to the database, and substitute calls on API-level.
Server/src/services/poi.service.ts
Outdated
return trackPOIs | ||
} | ||
|
||
// THIS METHOD IS NOT USED ANYMORE BUT HAS SOME LOGICS IN IT |
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.
This method was once designed for the frontend to only get a few (maybe only upcoming) points of interest. However it turned out the frontend can easily handle all POI's for one track. The same goes for getNearbyVehicles in the vehicle-service. But for this case we need to do some refactoring as it gets actually called, but is way to complex (and overpowered) for the way it gets used. I already opened issue #114 for that.
* @param data data received by a tracker | ||
* @returns a new entry `Log` if successful, `null` otherwise | ||
*/ | ||
public static async appendTrackerLog( |
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.
Not sure, if this logic is needed, because of how the trackers work. That is something the hardware team definitely should look on.
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.
The logic is not needed anymore :) If we need something in the future we will extend the new appendLog
function of the TrackerService.
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.
The suggestion for the outsourcing of the filter step to the DB controller can be addressed in another issue but please have a look at the comment about formatting and ignoring eslint violations :)
return poi.typeId == type.uid | ||
}) | ||
return trackPOIs | ||
} |
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 could move the filter-by-type functionality to the POI DB Controller and let Prisma handle the filter step.
* @param data data received by a tracker | ||
* @returns a new entry `Log` if successful, `null` otherwise | ||
*/ | ||
public static async appendTrackerLog( |
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.
The logic is not needed anymore :) If we need something in the future we will extend the new appendLog
function of the TrackerService.
@@ -128,7 +95,7 @@ export default class VehicleService { | |||
return null | |||
} | |||
|
|||
allVehiclesOnTrack.filter(async function (vehicle, index, vehicles) { | |||
allVehiclesOnTrack.filter(async function(vehicle, index, vehicles) { |
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.
Please apply the formatting rules and let prettier add the whitespace in front of the function keyword. On the other hand, there are multiple eslint violations because the function contains unused arguments that don't follow the defined pattern.
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.
The formatting rules are applied. The whitespaces in front of the function keyword is not defined by the current prettier-config. That means it has to be added into the IDE-settings manually. I think we might need to add some 'Style Guide' in the README in the Server directory for those sorts of issues.
I will have a look at those eslint-violations.
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.
Formatting rules.. the bane of our existence. I will check my IDE for the specific setting :D
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.
Looks good.
No description provided.