Skip to content

Commit

Permalink
feat: support allRepliedArticles and articlesHasUsefulReplies
Browse files Browse the repository at this point in the history
  • Loading branch information
MrOrz committed Feb 13, 2024
1 parent 501c33d commit 0b88718
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ async function getData() {
allArticles: ListArticles @skip(if: $bar) {
totalCount
}
allRepliedArticles: ListArticles {
allRepliedArticles: ListArticles(filter: { replyCount: { GTE: 1 } }) {
totalCount
}
articlesHasUsefulReplies: ListArticles {
articlesHasUsefulReplies: ListArticles(
filter: { hasArticleReplyWithMorePositiveFeedback: true }
) {
totalCount
}
}
Expand Down
4 changes: 2 additions & 2 deletions typegen/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
* Therefore it is highly recommended to use the babel or swc plugin for production.
*/
const documents = {
"\n query LoadAPIStats($bar: Boolean!) {\n allArticles: ListArticles @skip(if: $bar) {\n totalCount\n }\n allRepliedArticles: ListArticles {\n totalCount\n }\n articlesHasUsefulReplies: ListArticles {\n totalCount\n }\n }\n ": types.LoadApiStatsDocument,
"\n query LoadAPIStats($bar: Boolean!) {\n allArticles: ListArticles @skip(if: $bar) {\n totalCount\n }\n allRepliedArticles: ListArticles(filter: { replyCount: { GTE: 1 } }) {\n totalCount\n }\n articlesHasUsefulReplies: ListArticles(\n filter: { hasArticleReplyWithMorePositiveFeedback: true }\n ) {\n totalCount\n }\n }\n ": types.LoadApiStatsDocument,
};

/**
Expand All @@ -33,7 +33,7 @@ export function graphql(source: string): unknown;
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query LoadAPIStats($bar: Boolean!) {\n allArticles: ListArticles @skip(if: $bar) {\n totalCount\n }\n allRepliedArticles: ListArticles {\n totalCount\n }\n articlesHasUsefulReplies: ListArticles {\n totalCount\n }\n }\n "): (typeof documents)["\n query LoadAPIStats($bar: Boolean!) {\n allArticles: ListArticles @skip(if: $bar) {\n totalCount\n }\n allRepliedArticles: ListArticles {\n totalCount\n }\n articlesHasUsefulReplies: ListArticles {\n totalCount\n }\n }\n "];
export function graphql(source: "\n query LoadAPIStats($bar: Boolean!) {\n allArticles: ListArticles @skip(if: $bar) {\n totalCount\n }\n allRepliedArticles: ListArticles(filter: { replyCount: { GTE: 1 } }) {\n totalCount\n }\n articlesHasUsefulReplies: ListArticles(\n filter: { hasArticleReplyWithMorePositiveFeedback: true }\n ) {\n totalCount\n }\n }\n "): (typeof documents)["\n query LoadAPIStats($bar: Boolean!) {\n allArticles: ListArticles @skip(if: $bar) {\n totalCount\n }\n allRepliedArticles: ListArticles(filter: { replyCount: { GTE: 1 } }) {\n totalCount\n }\n articlesHasUsefulReplies: ListArticles(\n filter: { hasArticleReplyWithMorePositiveFeedback: true }\n ) {\n totalCount\n }\n }\n "];

export function graphql(source: string) {
return (documents as any)[source] ?? {};
Expand Down
2 changes: 1 addition & 1 deletion typegen/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1398,4 +1398,4 @@ export type LoadApiStatsQueryVariables = Exact<{
export type LoadApiStatsQuery = { allArticles: { totalCount: number } | null, allRepliedArticles: { totalCount: number } | null, articlesHasUsefulReplies: { totalCount: number } | null };


export const LoadApiStatsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"LoadAPIStats"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"bar"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"allArticles"},"name":{"kind":"Name","value":"ListArticles"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"skip"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"if"},"value":{"kind":"Variable","name":{"kind":"Name","value":"bar"}}}]}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"allRepliedArticles"},"name":{"kind":"Name","value":"ListArticles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"articlesHasUsefulReplies"},"name":{"kind":"Name","value":"ListArticles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]} as unknown as DocumentNode<LoadApiStatsQuery, LoadApiStatsQueryVariables>;
export const LoadApiStatsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"LoadAPIStats"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"bar"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"allArticles"},"name":{"kind":"Name","value":"ListArticles"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"skip"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"if"},"value":{"kind":"Variable","name":{"kind":"Name","value":"bar"}}}]}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"allRepliedArticles"},"name":{"kind":"Name","value":"ListArticles"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"replyCount"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"GTE"},"value":{"kind":"IntValue","value":"1"}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"articlesHasUsefulReplies"},"name":{"kind":"Name","value":"ListArticles"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"hasArticleReplyWithMorePositiveFeedback"},"value":{"kind":"BooleanValue","value":true}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]} as unknown as DocumentNode<LoadApiStatsQuery, LoadApiStatsQueryVariables>;

0 comments on commit 0b88718

Please sign in to comment.