add contact tracker data layer: schemas, hooks, db queries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 11:15:17 +01:00
parent b884e4e8c4
commit 4e4be03466
4 changed files with 153 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
import { describe, expect, it } from "vitest";
import { kontaktFormSchema, therapeutFormSchema } from "./schema";
describe("therapeutFormSchema", () => {
it("accepts valid therapist", () => {
const result = therapeutFormSchema.safeParse({
name: "Dr. Schmidt",
plz: "10115",
stadt: "Berlin",
});
expect(result.success).toBe(true);
});
it("requires name", () => {
const result = therapeutFormSchema.safeParse({ name: "" });
expect(result.success).toBe(false);
});
it("allows empty optional fields", () => {
const result = therapeutFormSchema.safeParse({ name: "Dr. Schmidt" });
expect(result.success).toBe(true);
});
});
describe("kontaktFormSchema", () => {
it("accepts valid contact", () => {
const result = kontaktFormSchema.safeParse({
therapeut_id: 1,
datum: "2026-03-10",
kanal: "telefon",
ergebnis: "absage",
});
expect(result.success).toBe(true);
});
it("rejects missing date", () => {
const result = kontaktFormSchema.safeParse({
therapeut_id: 1,
datum: "",
kanal: "telefon",
ergebnis: "absage",
});
expect(result.success).toBe(false);
});
});