Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update schema and remove nestedPost #1025

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/client/src/actions/timeline.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {
AnyPost,
Paginated,
Post,
TimelineHighlightsRequest,
TimelineItem,
TimelineRequest,
Expand Down Expand Up @@ -47,6 +47,6 @@ export function fetchTimeline(
export function fetchTimelineHighlights(
client: AnyClient,
request: TimelineHighlightsRequest,
): ResultAsync<Paginated<Post> | null, UnexpectedError> {
): ResultAsync<Paginated<AnyPost>, UnexpectedError> {
return client.query(TimelineHighlightsQuery, { request });
}
34 changes: 23 additions & 11 deletions packages/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2222,18 +2222,31 @@ type GroupGatedFeedRule {
group: Group!
}

type GroupMember {
account: Account!
lastActiveAt: DateTime!
joinedAt: DateTime!
}

input GroupMembersFilterRequest {
"""The optional filter to narrow members by search query."""
searchBy: UsernameSearchInput
}

enum GroupMembersOrderBy {
LAST_JOINED
FIRST_JOINED
LAST_ACTIVE
ACCOUNT_SCORE
}

input GroupMembersRequest {
"""The group"""
group: EvmAddress!
filter: GroupMembersFilterRequest

"""The order by."""
orderBy: GroupMembersOrderBy! = LAST_JOINED
orderBy: GroupMembersOrderBy! = ACCOUNT_SCORE

"""The page size."""
pageSize: PageSize! = FIFTY
Expand Down Expand Up @@ -3672,8 +3685,6 @@ type NamespacesResult {
pageInfo: PaginatedResultInfo!
}

union NestedPost = Post | PostReference

type NetworkAddress {
address: EvmAddress!
chainId: Int!
Expand Down Expand Up @@ -3868,6 +3879,11 @@ type PaginatedGraphsResult {
pageInfo: PaginatedResultInfo!
}

type PaginatedGroupMembersResult {
items: [GroupMember!]!
pageInfo: PaginatedResultInfo!
}

type PaginatedGroupsResult {
"""The groups"""
items: [Group!]!
Expand Down Expand Up @@ -3975,9 +3991,9 @@ type Post {
timestamp: DateTime!
app: App
metadata: PostMetadata!
root: NestedPost
quoteOf: NestedPost
commentOn: NestedPost
root: Post
quoteOf: Post
commentOn: Post
actions: [PostAction!]!
operations: LoggedInPostOperations
stats: PostStats!
Expand Down Expand Up @@ -4113,10 +4129,6 @@ input PostReactionsRequest {
cursor: Cursor
}

type PostReference {
id: PostId!
}

enum PostReferenceType {
COMMENT_ON
REPOST_OF
Expand Down Expand Up @@ -4382,7 +4394,7 @@ type Query {
groups(request: GroupsRequest!): PaginatedGroupsResult!

"""Get the members of the group"""
groupMembers(request: GroupMembersRequest!): PaginatedAccountsResult!
groupMembers(request: GroupMembersRequest!): PaginatedGroupMembersResult!

"""Get the number of members in a Group"""
groupStats(request: GroupStatsRequest!): GroupStatsResponse!
Expand Down
28 changes: 4 additions & 24 deletions packages/graphql/src/fragments/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,6 @@ export const LoggedInPostOperationsFragment = graphql(
);
export type LoggedInPostOperations = FragmentOf<typeof LoggedInPostOperationsFragment>;

export const PostReferenceFragment = graphql(
`fragment PostReference on PostReference {
id
}`,
);
export type PostReference = FragmentOf<typeof PostReferenceFragment>;

export const ReferencedPostFragment = graphql(
`fragment ReferencedPost on Post {
__typename
Expand Down Expand Up @@ -214,19 +207,6 @@ export const ReferencedPostFragment = graphql(
],
);

export const NestedPostFragment = graphql(
`fragment NestedPost on NestedPost {
...on Post {
...ReferencedPost
}
...on PostReference {
...PostReference
}
}`,
[PostReferenceFragment, ReferencedPostFragment],
);
export type NestedPost = FragmentOf<typeof NestedPostFragment>;

export const PostFragment = graphql(
`fragment Post on Post {
__typename
Expand All @@ -245,13 +225,13 @@ export const PostFragment = graphql(
...PostMetadata
}
root {
...NestedPost
...ReferencedPost
}
quoteOf {
...NestedPost
...ReferencedPost
}
commentOn {
...NestedPost
...ReferencedPost
}
actions {
...PostAction
Expand All @@ -267,7 +247,7 @@ export const PostFragment = graphql(
Feed,
PostMetadataFragment,
PostActionFragment,
NestedPostFragment,
ReferencedPostFragment,
LoggedInPostOperationsFragment,
],
);
Expand Down
Loading
Loading