mirror of
https://github.com/wassname/talk.git
synced 2026-07-27 11:28:12 +08:00
[CORL-836] Create activeStories endpoint (#2787)
* Create activeStories GraphQL query endpoint Set lastCommentedAt on stories when they are commented upon. Use lastCommentedAt to retrieve the activeStories. Create a migration to partial index lastCommentedAt on stories to make retrieval fast. CORL-836 * fix: adjusted query to use index, more @auth directives Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
This commit is contained in:
committed by
Wyatt Johnson
co-authored by
Wyatt Johnson
parent
745fb4056c
commit
a88644d98e
@@ -3,19 +3,6 @@ import { defaultTo, isNil, omitBy } from "lodash";
|
||||
import { DateTime } from "luxon";
|
||||
|
||||
import Context from "coral-server/graph/context";
|
||||
import {
|
||||
CommentToParentsArgs,
|
||||
CommentToRepliesArgs,
|
||||
GQLActionPresence,
|
||||
GQLCOMMENT_SORT,
|
||||
GQLTAG,
|
||||
GQLUSER_ROLE,
|
||||
QueryToCommentsArgs,
|
||||
StoryToCommentsArgs,
|
||||
UserToAllCommentsArgs,
|
||||
UserToCommentsArgs,
|
||||
UserToRejectedCommentsArgs,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
import { retrieveManyUserActionPresence } from "coral-server/models/action/comment";
|
||||
import {
|
||||
Comment,
|
||||
@@ -36,6 +23,20 @@ import { Connection } from "coral-server/models/helpers";
|
||||
import { retrieveSharedModerationQueueQueuesCounts } from "coral-server/models/story/counts/shared";
|
||||
import { User } from "coral-server/models/user";
|
||||
|
||||
import {
|
||||
CommentToParentsArgs,
|
||||
CommentToRepliesArgs,
|
||||
GQLActionPresence,
|
||||
GQLCOMMENT_SORT,
|
||||
GQLTAG,
|
||||
GQLUSER_ROLE,
|
||||
QueryToCommentsArgs,
|
||||
StoryToCommentsArgs,
|
||||
UserToAllCommentsArgs,
|
||||
UserToCommentsArgs,
|
||||
UserToRejectedCommentsArgs,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
import { SingletonResolver } from "./util";
|
||||
|
||||
const tagFilter = (tag?: GQLTAG): CommentConnectionInput["filter"] => {
|
||||
|
||||
@@ -2,12 +2,9 @@ import DataLoader from "dataloader";
|
||||
import { defaultTo } from "lodash";
|
||||
|
||||
import GraphContext from "coral-server/graph/context";
|
||||
import {
|
||||
GQLSTORY_STATUS,
|
||||
QueryToStoriesArgs,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
import { Connection } from "coral-server/models/helpers";
|
||||
import {
|
||||
retrieveActiveStories,
|
||||
retrieveManyStories,
|
||||
retrieveStoryConnection,
|
||||
Story,
|
||||
@@ -21,6 +18,11 @@ import {
|
||||
} from "coral-server/services/stories";
|
||||
import { scraper } from "coral-server/services/stories/scraper";
|
||||
|
||||
import {
|
||||
GQLSTORY_STATUS,
|
||||
QueryToStoriesArgs,
|
||||
} from "coral-server/graph/schema/__generated__/types";
|
||||
|
||||
import { createManyBatchLoadFn } from "./util";
|
||||
|
||||
const statusFilter = (
|
||||
@@ -127,4 +129,6 @@ export default (ctx: GraphContext) => ({
|
||||
cache: !ctx.disableCaching,
|
||||
}
|
||||
),
|
||||
activeStories: (limit: number) =>
|
||||
retrieveActiveStories(ctx.mongo, ctx.tenant.id, limit),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user