refactor(schemas): extract nullable-default helpers to shared file
The three defensive Zod helpers (stringOrEmpty, numberOrZero, booleanOrFalse) used by user.ts are general-purpose Zod utilities that any schema may need — they're not user-specific. The original inline declaration in user.ts had two downsides: 1. Any new schema (chat, auth, metrics, etc.) that needs the same 'null | undefined → default scalar' pattern would have to duplicate the helper. 2. The long defensive-parse comment block (11 lines) lived inside user.ts and didn't explain the helpers' general purpose. Move them to src/data/schemas/nullable-defaults.ts (top-level sibling of auth/, chat/, metrics/, user/ subdirs) so any schema can import them. Keep the original explanation verbatim at the top of the new file. Bundled in this commit: - user.ts imports the helpers from the new file (drops 11 lines of comment + 3 const declarations) - 3 auto-generated barrel index files regenerated by barrelsby to pick up the new exports (chat/, subscription/, stores/user/)
This commit is contained in:
@@ -5,7 +5,9 @@
|
||||
export * from "./subscription-back-link";
|
||||
export * from "./subscription-banner";
|
||||
export * from "./subscription-benefits-card";
|
||||
export * from "./subscription-checkout-button";
|
||||
export * from "./subscription-cta-button";
|
||||
export * from "./subscription-manage-button";
|
||||
export * from "./subscription-plan-card";
|
||||
export * from "./subscription-screen";
|
||||
export * from "./subscription-user-row";
|
||||
|
||||
Reference in New Issue
Block a user