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

[CORL-2905]: add optional count param to active stories script #4342

Merged
merged 2 commits into from
Sep 26, 2023
Merged
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
6 changes: 4 additions & 2 deletions server/src/core/server/app/handlers/api/story/active.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ export type Options = Pick<AppOptions, "mongo">;
const ActiveStoriesQuerySchema = Joi.object().keys({
callback: Joi.string().allow("").optional(),
siteID: Joi.string().required(),
count: Joi.number().optional().max(999),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

});

interface ActiveStoriesQuery {
callback: string;
siteID: string;
count: number;
}

/**
Expand All @@ -44,7 +46,7 @@ export const activeJSONPHandler =
const { tenant, now } = req.coral;

// Ensure we have a siteID on the query.
const { siteID }: ActiveStoriesQuery = validate(
const { siteID, count }: ActiveStoriesQuery = validate(
ActiveStoriesQuerySchema,
req.query
);
Expand All @@ -61,7 +63,7 @@ export const activeJSONPHandler =
mongo,
tenant.id,
siteID,
5,
count ?? 5,
start,
now
);
Expand Down
Loading