feat: added closedAt to createStory mutation (#2496)

This commit is contained in:
Wyatt Johnson
2019-08-23 18:01:43 +00:00
committed by Kim Gardner
parent 1c75b7659d
commit 2edabf44c7
3 changed files with 12 additions and 3 deletions
@@ -3479,6 +3479,13 @@ input CreateStory {
be scraped, but can be provided here.
"""
metadata: StoryMetadataInput
"""
closedAt when provided specifies the date that the given story will be closed
at. If not provided, the story close will use the settings to determine the
automatic close date.
"""
closedAt: Time
}
input CreateStoryInput {
+3 -1
View File
@@ -222,7 +222,9 @@ export async function findOrCreateStory(
return upsertStory(mongo, tenantID, { url }, now);
}
export type CreateStoryInput = Partial<Pick<Story, "metadata" | "scrapedAt">>;
export type CreateStoryInput = Partial<
Pick<Story, "metadata" | "scrapedAt" | "closedAt">
>;
export async function createStory(
mongo: Db,
+2 -2
View File
@@ -163,7 +163,7 @@ export async function create(
tenant: Tenant,
storyID: string,
storyURL: string,
{ metadata }: CreateStory,
{ metadata, closedAt }: CreateStory,
now = new Date()
) {
// Ensure that the given URL is allowed.
@@ -175,7 +175,7 @@ export async function create(
}
// Construct the input payload.
const input: CreateStoryInput = { metadata };
const input: CreateStoryInput = { metadata, closedAt };
if (metadata) {
input.scrapedAt = now;
}