fix(request-context): block sunset products in public productId resolver

This commit is contained in:
saravanakumardb1 2026-02-16 23:45:17 -08:00
parent b0e8304d59
commit 18a5b342d9

View File

@ -74,15 +74,15 @@ export function getRequestProductId(req: FastifyRequest): string {
} }
/** /**
* Extract productId with relaxed status gating permits `pre_launch` and `sunset`. * Extract productId with relaxed status gating permits `pre_launch`.
* Used by public waitlist routes where the product isn't fully operational yet. * Used by public waitlist routes where the product isn't fully operational yet.
* Blocks only: `draft`, `disabled`. * Blocks: `draft`, `sunset`, `disabled`.
*/ */
export function getRequestProductIdForPublic(req: FastifyRequest): string { export function getRequestProductIdForPublic(req: FastifyRequest): string {
const id = extractProductId(req); const id = extractProductId(req);
const product = getProduct(id)!; const product = getProduct(id)!;
if (product.status === 'draft' || product.status === 'disabled') { if (product.status === 'draft' || product.status === 'sunset' || product.status === 'disabled') {
throw new BadRequestError(`Product ${id} is not available (status: ${product.status})`); throw new BadRequestError(`Product ${id} is not available (status: ${product.status})`);
} }