mirror of
https://github.com/wassname/talk.git
synced 2026-07-06 05:17:19 +08:00
feat: added closedAt to createStory mutation (#2496)
This commit is contained in:
committed by
Kim Gardner
parent
1c75b7659d
commit
2edabf44c7
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user