Created
September 7, 2020 04:46
-
-
Save alfari16/3fe7676f3aed8fafae4764ad849ff736 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // resolvers.ts | |
| // ...other codes | |
| export default { | |
| // ...other codes | |
| Merchant: { | |
| products({id: merchantId}: Merchant, {pagination: input}: {pagination: IPagination}, {loaders}: IGraphQLSchemaContext) { | |
| const paginationCollector = { | |
| limit: input?.limit || 10, | |
| offset: input?.offset || 0, | |
| sortBy: input?.sortBy || PaginationSortByEnum.ASC, | |
| orderBy: input?.orderBy || "createdAt", | |
| search: input?.search || '' | |
| } | |
| return loaders.getProductsByMerchantId(paginationCollector).load(merchantId); | |
| }, | |
| // ...other codes | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment