All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 50s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
875 B
TypeScript
27 lines
875 B
TypeScript
import type {
|
|
CreateCategoryRequest,
|
|
UpdateCategoryRequest,
|
|
} from "../../shared/category.ts";
|
|
|
|
export function isCreateCategoryRequest(
|
|
obj: unknown,
|
|
): obj is CreateCategoryRequest {
|
|
if (!obj || typeof obj !== "object") return false;
|
|
const o = obj as Record<string, unknown>;
|
|
if (typeof o.slug !== "string") return false;
|
|
if (typeof o.name !== "string") return false;
|
|
if ("position" in o && typeof o.position !== "number") return false;
|
|
return true;
|
|
}
|
|
|
|
export function isUpdateCategoryRequest(
|
|
obj: unknown,
|
|
): obj is UpdateCategoryRequest {
|
|
if (!obj || typeof obj !== "object") return false;
|
|
const o = obj as Record<string, unknown>;
|
|
if ("slug" in o && typeof o.slug !== "string") return false;
|
|
if ("name" in o && typeof o.name !== "string") return false;
|
|
if ("position" in o && typeof o.position !== "number") return false;
|
|
return true;
|
|
}
|