From edbed65fc316f8a3b935c55acdc3f307debefe78 Mon Sep 17 00:00:00 2001 From: Peter Harrison <16875803+palisadoes@users.noreply.github.com> Date: Wed, 28 Feb 2024 13:40:11 -0800 Subject: [PATCH] Revert "Revert "Fix/fetch postby user (#1910)" (#1913)" (#1914) This reverts commit 14301a757df747e8e1cfc9732d68d34fa38cfc85. --- schema.graphql | 2 +- src/resolvers/Organization/index.ts | 3 ++- src/typeDefs/types.ts | 2 +- src/types/generatedGraphQLTypes.ts | 4 ++-- tests/resolvers/Organization/posts.spec.ts | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/schema.graphql b/schema.graphql index f1a198c875..086771813c 100644 --- a/schema.graphql +++ b/schema.graphql @@ -1223,7 +1223,7 @@ input PostWhereInput { type PostsConnection { edges: [PostEdge!]! - pageInfo: ConnectionPageInfo! + pageInfo: DefaultConnectionPageInfo! totalCount: PositiveInt } diff --git a/src/resolvers/Organization/index.ts b/src/resolvers/Organization/index.ts index bba49bc7d6..3bc6300af8 100644 --- a/src/resolvers/Organization/index.ts +++ b/src/resolvers/Organization/index.ts @@ -8,8 +8,8 @@ import { funds } from "./funds"; import { image } from "./image"; import { members } from "./members"; import { membershipRequests } from "./membershipRequests"; - import { pinnedPosts } from "./pinnedPosts"; +import { posts } from "./posts"; import { advertisements } from "./advertisements"; @@ -27,5 +27,6 @@ export const Organization: OrganizationResolvers = { membershipRequests, pinnedPosts, funds, + posts, // userTags, }; diff --git a/src/typeDefs/types.ts b/src/typeDefs/types.ts index 4c522631df..3d7c78b4e2 100644 --- a/src/typeDefs/types.ts +++ b/src/typeDefs/types.ts @@ -531,7 +531,7 @@ export const types = gql` } type PostsConnection { edges: [PostEdge!]! - pageInfo: ConnectionPageInfo! + pageInfo: DefaultConnectionPageInfo! totalCount: PositiveInt } type PostEdge { diff --git a/src/types/generatedGraphQLTypes.ts b/src/types/generatedGraphQLTypes.ts index 08883199f7..a79a131129 100644 --- a/src/types/generatedGraphQLTypes.ts +++ b/src/types/generatedGraphQLTypes.ts @@ -1924,7 +1924,7 @@ export type PostWhereInput = { export type PostsConnection = { __typename?: 'PostsConnection'; edges: Array; - pageInfo: ConnectionPageInfo; + pageInfo: DefaultConnectionPageInfo; totalCount?: Maybe; }; @@ -3727,7 +3727,7 @@ export type PostEdgeResolvers = { edges?: Resolver, ParentType, ContextType>; - pageInfo?: Resolver; + pageInfo?: Resolver; totalCount?: Resolver, ParentType, ContextType>; __isTypeOf?: IsTypeOfResolverFn; }; diff --git a/tests/resolvers/Organization/posts.spec.ts b/tests/resolvers/Organization/posts.spec.ts index fa40167fc1..08fb3030e2 100644 --- a/tests/resolvers/Organization/posts.spec.ts +++ b/tests/resolvers/Organization/posts.spec.ts @@ -68,7 +68,7 @@ describe("resolvers -> Organization -> post", () => { ); const totalCount = await Post.find({ - creatorId: testUser?._id, + organization: testOrganization?._id, }).countDocuments(); expect((connection?.edges[0] as unknown as PostEdge).cursor).toEqual(