fix(review): Create desc gate does not require price

This commit is contained in:
grokbot_ty
2026-09-26 10:30:55 -07:00
parent 1464cac5f7
commit 076eb17db6
3 changed files with 11 additions and 19 deletions
+1 -11
View File
@@ -1,7 +1,6 @@
/**
* Create-desc gate (Call 2): disable Create desc unless these are present.
* Does NOT require description (that is what Create desc writes).
* Price included for parity with publish-ready.
* Does NOT require description OR price (price stays publish-only).
*/
export type CreateDescInput = {
@@ -15,7 +14,6 @@ export type CreateDescInput = {
figureTermIds: number[];
gradeTermId: number | string | '' | null | undefined;
moistureTermId: number | string | '' | null | undefined;
price: string | number | null | undefined;
};
/** Human labels shown under Create desc when the gate fails. */
@@ -30,7 +28,6 @@ export const CREATE_DESC_LABELS: Record<string, string> = {
figure: '≥1 figure',
grade: 'grade',
moisture: 'moisture',
price: 'price',
};
function presentId(v: number | string | '' | null | undefined): boolean {
@@ -39,12 +36,6 @@ function presentId(v: number | string | '' | null | undefined): boolean {
return String(v).trim() !== '';
}
function presentPrice(v: string | number | null | undefined): boolean {
if (v === null || v === undefined || v === '') return false;
const n = typeof v === 'number' ? v : Number(v);
return Number.isFinite(n);
}
/** Return missing field keys (stable order). Empty ⇒ Create desc enabled. */
export function missingCreateDesc(input: CreateDescInput): string[] {
const missing: string[] = [];
@@ -58,7 +49,6 @@ export function missingCreateDesc(input: CreateDescInput): string[] {
if (!input.figureTermIds?.length) missing.push('figure');
if (!presentId(input.gradeTermId)) missing.push('grade');
if (!presentId(input.moistureTermId)) missing.push('moisture');
if (!presentPrice(input.price)) missing.push('price');
return missing;
}