lila/packages/shared/src/schema.ts
2026-04-02 20:02:26 +02:00

72 lines
1.5 KiB
TypeScript

import * as z from "zod";
export const Term = z.object({
id: z.uuid(),
synset_id: z.string(),
pos: z.string(),
created_at: z.iso.datetime(),
});
export type Term = z.infer<typeof Term>;
export const Translation = z.object({
id: z.uuid(),
term_id: z.string(),
language_code: z.string(),
text: z.string(),
created_at: z.iso.datetime(),
});
export type Translation = z.infer<typeof Translation>;
export const TermGloss = z.object({
id: z.uuid(),
term_id: z.uuid(),
language_code: z.string(),
text: z.string(),
created_at: z.iso.datetime(),
});
export type TermGloss = z.infer<typeof TermGloss>;
export const LanguagePair = z.object({
id: z.uuid(),
source_language: z.string(),
target_language: z.string(),
label: z.string(),
active: z.boolean(),
created_at: z.iso.datetime(),
});
export type LanguagePair = z.infer<typeof LanguagePair>;
export const User = z.object({
id: z.uuid(),
openauth_sub: z.string(),
email: z.email(),
display_name: z.string(),
created_at: z.iso.datetime(),
last_login_at: z.iso.datetime(),
});
export type User = z.infer<typeof User>;
export const Deck = z.object({
id: z.uuid(),
name: z.string(),
desciption: z.string(),
source_language: z.string(),
validated_languages: z.array(z.string()),
is_public: z.boolean(),
created_at: z.iso.datetime(),
});
export type Deck = z.infer<typeof Deck>;
export const DeckTerm = z.object({
deck_id: z.uuid(),
term_id: z.uuid(),
added: z.iso.datetime(),
});
export type DeckTerm = z.infer<typeof DeckTerm>;