-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(snippet): create query to retrieve public snippets
- Loading branch information
1 parent
8d82b95
commit a4bd6b2
Showing
6 changed files
with
261 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
apps/core/src/resources/snippets/queries/public-snippets.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { QueryResolvers } from '../../../types/graphql'; | ||
|
||
export const publicSnippets: QueryResolvers['publicSnippets'] = async (_parent, input, context) => { | ||
const { | ||
args: { itemPerPage, nextToken }, | ||
} = input; | ||
|
||
const result = await context.db.snippet.findPublicSnippet({ | ||
cursor: nextToken, | ||
itemPerPage: itemPerPage ?? 10, | ||
}); | ||
|
||
return { | ||
hasMore: result.hasMore, | ||
itemPerPage, | ||
items: result.items, | ||
nextToken: result.nextCursor, | ||
}; | ||
}; |
This file contains 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
Oops, something went wrong.