Open
Description
On the whole, the template looks good. There are a couple of things I would change to better make use of the existing codebase:
createNodeblocksGuestOrderApp.ts
androutes.ts
should not exist in this repo, but instead use the functions from the order service package. The concept of this adapter is to demonstrate a custom adapter, not to make a full service from scratch, so we should only be replacing just the 'adapter' part.- The
GuestOrderAdapter
type should also be removed, and the adapter class should implementOrderAdapter
imported from the order service package. Any routes not supported at this time can be set to the following, similar to how the messaging service handles unsupported routes:
- The
{
handler: adapter.notFoundHandler,
validators: {},
};
Other things I noticed
- It might be clearer to place
adapter.ts
inside of theadapter/guest-orders
folder - The validator unit tests should be placed inside of a
validators
folder, similar to handlers - There should be authentication and authorization validation on get/list orders that limits them to admin users only.
prepareGuestOrderResponse
and similar utils would be better off on the dataService class, as that wayorganizationAPI
andcustomFields
can be read from the class properties, making these functions take much fewer arguments- The paginated list handler and data service method can be simplified a lot by using the backend sdk's methods for pagination. Take a look at the catalog service list endpoints (e.g. listAttributes) for an example. It should be able to reduce the amount of lines needed by 2/3.
Activity