-
Notifications
You must be signed in to change notification settings - Fork 11
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
Improve routing API #20
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.
Where'd the tests go?
Sources/VaporWalletOrders/OrdersServiceCustom+RouteCollection.swift
Outdated
Show resolved
Hide resolved
I removed only the tests related to the two "push routes", which I would like to remove The first one when called sent a push notification to all devices registered to a specific pass, the other one returned as a response the push tokens of all devices registered to a pass Their usefulness is questionable in my opinion, and their initialization required (rightly) a middleware, that with this refactoring of the routes into a P.S. Of course we already provide the methods that these routes used internally and they are easily reimplementable by the user if they need them |
I'm not against removing useless things but we should be testing what's public so if you remove tests I'd remove the tested routes too. When reviewing it seemed like you only removed the tests and not the routes |
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.
Definitely need better variable names. I'm assuming all the new push stuff is tested?
One thing I want to check now that we're relying on route registration is that it works with nested stuff unlike the Imperial issues?
Sources/VaporWalletOrders/OrdersServiceCustom+RouteCollection.swift
Outdated
Show resolved
Hide resolved
Yes, I also removed push routes, you can see that service initializers no longer accept the |
The push notifications public methods haven't changed (they were already tested), I just removed the so called "push routes" which were a duplicate way to send notifications (not required by Apple Wallet API specification) |
The difference between this package and Imperial is that Imperial automatically returns the URL to the API based on the registered route, whereas here the route registration and the URL encoding are two completely separate things. So it works perfectly in nested routes, but you have to manually build the URL when encoding the pass. For example, if you register the routes like this: try app.grouped("api", "passes").register(collection: passesService) you have to set the let webServiceURL = "\(Environment.get("WEBSITE_URL")!)/api/passes/" If we find a solution to this common problem we could think of automatically injecting the path |
PassesService
andOrdersService
conform toRouteCollection
RoutesBuilder
Logger
inside routes (instead of one provided by the user)pushRoutesMiddleware
sendPushNotifications
were not public