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

111 clean services #113

Merged
merged 5 commits into from
Sep 4, 2023
Merged

111 clean services #113

merged 5 commits into from
Sep 4, 2023

Conversation

liamboddin
Copy link
Contributor

No description provided.

@liamboddin liamboddin linked an issue Aug 31, 2023 that may be closed by this pull request
Copy link
Contributor

@Kebslock Kebslock left a 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.

return trackPOIs
}

// THIS METHOD IS NOT USED ANYMORE BUT HAS SOME LOGICS IN IT
Copy link
Contributor

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(
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

@JulianGrabitzky JulianGrabitzky left a 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
}
Copy link
Contributor

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(
Copy link
Contributor

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor

@JulianGrabitzky JulianGrabitzky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@liamboddin liamboddin merged commit 50d0b5c into development Sep 4, 2023
1 check passed
@liamboddin liamboddin deleted the 111-clean-services branch September 4, 2023 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backend: Clean up Services
3 participants