diff --git a/src/core/server/graph/loaders/CommentModerationActions.ts b/src/core/server/graph/loaders/CommentModerationActions.ts index 874bc3fdc8..8f669795e1 100644 --- a/src/core/server/graph/loaders/CommentModerationActions.ts +++ b/src/core/server/graph/loaders/CommentModerationActions.ts @@ -4,13 +4,13 @@ import GraphContext from "coral-server/graph/context"; import { retrieveCommentModerationActionConnection } from "coral-server/models/action/moderation/comment"; import { - CommentToStatusHistoryArgs, - UserToCommentModerationActionHistoryArgs, + GQLCommentGQLstatusHistoryArgs, + GQLUserGQLcommentModerationActionHistoryArgs, } from "coral-server/graph/schema/__generated__/types"; export default (ctx: GraphContext) => ({ forModerator: ( - { first, after }: UserToCommentModerationActionHistoryArgs, + { first, after }: GQLUserGQLcommentModerationActionHistoryArgs, moderatorID: string ) => retrieveCommentModerationActionConnection(ctx.mongo, ctx.tenant.id, { @@ -21,7 +21,7 @@ export default (ctx: GraphContext) => ({ }, }), forComment: ( - { first, after }: CommentToStatusHistoryArgs, + { first, after }: GQLCommentGQLstatusHistoryArgs, commentID: string ) => retrieveCommentModerationActionConnection(ctx.mongo, ctx.tenant.id, { diff --git a/src/core/server/graph/loaders/Comments.ts b/src/core/server/graph/loaders/Comments.ts index bcf6ef4b2b..401ec89303 100644 --- a/src/core/server/graph/loaders/Comments.ts +++ b/src/core/server/graph/loaders/Comments.ts @@ -30,19 +30,19 @@ import { } from "coral-server/services/comments"; import { - CommentToParentsArgs, - CommentToRepliesArgs, GQLActionPresence, GQLCOMMENT_SORT, + GQLCommentGQLparentsArgs, + GQLCommentGQLrepliesArgs, GQLFEATURE_FLAG, + GQLQueryGQLcommentsArgs, GQLSTORY_MODE, + GQLStoryGQLcommentsArgs, GQLTAG, GQLUSER_ROLE, - QueryToCommentsArgs, - StoryToCommentsArgs, - UserToAllCommentsArgs, - UserToCommentsArgs, - UserToRejectedCommentsArgs, + GQLUserGQLallCommentsArgs, + GQLUserGQLcommentsArgs, + GQLUserGQLrejectedCommentsArgs, } from "coral-server/graph/schema/__generated__/types"; import { requiredPropertyFilter, sectionFilter } from "./helpers"; @@ -214,7 +214,7 @@ export default (ctx: GraphContext) => ({ tag, query, orderBy, - }: QueryToCommentsArgs) => { + }: GQLQueryGQLcommentsArgs) => { let story: Readonly | null = null; if (storyID) { story = await ctx.loaders.Stories.story.load(storyID); @@ -268,13 +268,16 @@ export default (ctx: GraphContext) => ({ ); } ), - forUser: (userID: string, { first, orderBy, after }: UserToCommentsArgs) => + forUser: ( + userID: string, + { first, orderBy, after }: GQLUserGQLcommentsArgs + ) => retrieveCommentUserConnection(ctx.mongo, ctx.tenant.id, userID, { first: defaultTo(first, 10), orderBy: defaultTo(orderBy, GQLCOMMENT_SORT.CREATED_AT_DESC), after, }).then(primeCommentsFromConnection(ctx)), - forUserAll: (userID: string, { first, after }: UserToAllCommentsArgs) => + forUserAll: (userID: string, { first, after }: GQLUserGQLallCommentsArgs) => retrieveAllCommentsUserConnection(ctx.mongo, ctx.tenant.id, userID, { first: defaultTo(first, 10), orderBy: GQLCOMMENT_SORT.CREATED_AT_DESC, @@ -282,7 +285,7 @@ export default (ctx: GraphContext) => ({ }).then(primeCommentsFromConnection(ctx)), forUserRejected: ( userID: string, - { first, after }: UserToRejectedCommentsArgs + { first, after }: GQLUserGQLrejectedCommentsArgs ) => retrieveRejectedCommentUserConnection(ctx.mongo, ctx.tenant.id, userID, { first: defaultTo(first, 10), @@ -292,7 +295,7 @@ export default (ctx: GraphContext) => ({ taggedForStory: async ( storyID: string, tag: GQLTAG, - { first, orderBy, after }: StoryToCommentsArgs + { first, orderBy, after }: GQLStoryGQLcommentsArgs ) => { const story = await ctx.loaders.Stories.story.load(storyID); if (!story) { @@ -318,7 +321,14 @@ export default (ctx: GraphContext) => ({ }, forStory: async ( storyID: string, - { first, orderBy, after, tag, rating, refreshStream }: StoryToCommentsArgs + { + first, + orderBy, + after, + tag, + rating, + refreshStream, + }: GQLStoryGQLcommentsArgs ) => { const story = await ctx.loaders.Stories.story.load(storyID); if (!story) { @@ -381,7 +391,7 @@ export default (ctx: GraphContext) => ({ forParent: async ( storyID: string, parentID: string, - { first, orderBy, after, flatten, refreshStream }: CommentToRepliesArgs + { first, orderBy, after, flatten, refreshStream }: GQLCommentGQLrepliesArgs ) => { const story = await ctx.loaders.Stories.story.load(storyID); if (!story) { @@ -434,7 +444,10 @@ export default (ctx: GraphContext) => ({ return conn; }, - parents: async (comment: Comment, { last, before }: CommentToParentsArgs) => { + parents: async ( + comment: Comment, + { last, before }: GQLCommentGQLparentsArgs + ) => { const story = await ctx.loaders.Stories.story.load(comment.storyID); if (!story) { throw new StoryNotFoundError(comment.storyID); @@ -454,7 +467,7 @@ export default (ctx: GraphContext) => ({ }, allChildComments: async ( comment: Comment, - { orderBy }: CommentToRepliesArgs + { orderBy }: GQLCommentGQLrepliesArgs ) => { const story = await ctx.loaders.Stories.story.load(comment.storyID); if (!story) { diff --git a/src/core/server/graph/loaders/Sites.ts b/src/core/server/graph/loaders/Sites.ts index d879859bfc..374a47a97f 100644 --- a/src/core/server/graph/loaders/Sites.ts +++ b/src/core/server/graph/loaders/Sites.ts @@ -9,7 +9,7 @@ import { SiteConnectionInput, } from "coral-server/models/site"; -import { QueryToSitesArgs } from "coral-server/graph/schema/__generated__/types"; +import { GQLQueryGQLsitesArgs } from "coral-server/graph/schema/__generated__/types"; const queryFilter = (query?: string): SiteConnectionInput["filter"] => { if (query) { @@ -26,7 +26,7 @@ export default (ctx: TenantContext) => ({ cache: !ctx.disableCaching, } ), - connection: ({ first, after, query }: QueryToSitesArgs) => + connection: ({ first, after, query }: GQLQueryGQLsitesArgs) => retrieveSiteConnection(ctx.mongo, ctx.tenant.id, { first: defaultTo(first, 20), after, diff --git a/src/core/server/graph/loaders/Stories.ts b/src/core/server/graph/loaders/Stories.ts index dedaad83f9..f98a9b42d5 100644 --- a/src/core/server/graph/loaders/Stories.ts +++ b/src/core/server/graph/loaders/Stories.ts @@ -30,10 +30,10 @@ import { import { scraper } from "coral-server/services/stories/scraper"; import { + GQLQueryGQLstoriesArgs, + GQLSiteGQLtopStoriesArgs, GQLSTORY_STATUS, - QueryToStoriesArgs, - SiteToTopStoriesArgs, - UserToOngoingDiscussionsArgs, + GQLUserGQLongoingDiscussionsArgs, } from "coral-server/graph/schema/__generated__/types"; import { createManyBatchLoadFn } from "./util"; @@ -215,7 +215,13 @@ export default (ctx: GraphContext) => ({ cache: !ctx.disableCaching, } ), - connection: ({ first, after, status, query, siteIDs }: QueryToStoriesArgs) => + connection: ({ + first, + after, + status, + query, + siteIDs, + }: GQLQueryGQLstoriesArgs) => retrieveStoryConnection(ctx.mongo, ctx.tenant.id, { first: defaultTo(first, 10), after, @@ -229,7 +235,7 @@ export default (ctx: GraphContext) => ({ ...queryFilter(query), }, }).then(primeStoriesFromConnection(ctx)), - topStories: (siteID: string, { limit }: SiteToTopStoriesArgs) => { + topStories: (siteID: string, { limit }: GQLSiteGQLtopStoriesArgs) => { // Find top active stories in the last 24 hours. const start = DateTime.fromJSDate(ctx.now).minus({ hours: 24 }).toJSDate(); @@ -266,7 +272,7 @@ export default (ctx: GraphContext) => ({ ), ongoingDiscussions: ( authorID: string, - { limit }: UserToOngoingDiscussionsArgs + { limit }: GQLUserGQLongoingDiscussionsArgs ) => retrieveOngoingDiscussions( ctx.mongo, diff --git a/src/core/server/graph/loaders/Users.ts b/src/core/server/graph/loaders/Users.ts index e3e1337dec..24cfcf9456 100644 --- a/src/core/server/graph/loaders/Users.ts +++ b/src/core/server/graph/loaders/Users.ts @@ -11,9 +11,9 @@ import { } from "coral-server/models/user"; import { + GQLQueryGQLusersArgs, GQLUSER_ROLE, GQLUSER_STATUS_FILTER, - QueryToUsersArgs, } from "coral-server/graph/schema/__generated__/types"; type UserConnectionFilterInput = UserConnectionInput["filter"]; @@ -115,7 +115,7 @@ export default (ctx: Context) => { return { user, - connection: ({ first, after, role, query, status }: QueryToUsersArgs) => + connection: ({ first, after, role, query, status }: GQLQueryGQLusersArgs) => retrieveUserConnection(ctx.mongo, ctx.tenant.id, { first: defaultTo(first, 10), after,