Open source personal finance application
feat: add Zod schemas for locale, rates, and user settings
Ilya Komichev14584103c8f8
diff --git a/app/components/currencies/types.ts b/app/components/currencies/types.tsindex 9f4815f7..6690ec55 100644--- a/app/components/currencies/types.ts+++ b/app/components/currencies/types.ts@@ -1,3 +1,7 @@+import { z } from 'zod/v4'+export type CurrencyCode = string-export type Rates = Record<CurrencyCode, number>+export const ratesSchema = z.record(z.string(), z.number())++export type Rates = z.infer<typeof ratesSchema>diff --git a/app/components/locale/types.ts b/app/components/locale/types.tsindex e5f574bc..d180cf23 100644--- a/app/components/locale/types.ts+++ b/app/components/locale/types.ts@@ -1 +1,4 @@-export type LocaleSlug = 'en' | 'ru'+import { z } from 'zod/v4'++export const localeSchema = z.enum(['en', 'ru'])+export type LocaleSlug = z.infer<typeof localeSchema>diff --git a/app/components/user/types.ts b/app/components/user/types.tsnew file mode 100644index 00000000..9866e9ea--- /dev/null+++ b/app/components/user/types.ts@@ -0,0 +1,10 @@+import { z } from 'zod/v4'++import { localeSchema } from '~/components/locale/types'++export const userSettingsSchema = z.object({+ baseCurrency: z.string().min(1).default('USD'),+ locale: localeSchema.optional(),+})++export type UserSettings = z.infer<typeof userSettingsSchema>