feat: app shell, UI kit, data loading, recurring sync
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
23f3192cd0
commit
08f23f909f
14 files changed
+493
-7
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { MobileNav } from "@/components/MobileNav";
|
||||
import { Sidebar } from "@/components/Sidebar";
|
||||
import { requireUser } from "@/server/auth";
|
||||
import { syncRecurrings } from "@/server/sync";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function AppLayout({ children }: { children: React.ReactNode }) {
|
||||
const user = await requireUser();
|
||||
await syncRecurrings();
|
||||
return (
|
||||
<div className="min-h-dvh md:flex">
|
||||
<Sidebar user={user} />
|
||||
<main className="mx-auto w-full max-w-[1200px] flex-1 px-4 pb-28 pt-5 md:px-7 md:pb-8 md:pt-6">{children}</main>
|
||||
<MobileNav />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,12 +1,6 @@
|
||||
import { requireUser } from "@/server/auth";
|
||||
import { logoutAction } from "@/server/actions/auth";
|
||||
|
||||
export default async function DashboardPage() {
|
||||
const user = await requireUser();
|
||||
return (
|
||||
<main className="p-8">
|
||||
<p>Bonjour {user.firstName}</p>
|
||||
<form action={logoutAction}><button>Déconnexion</button></form>
|
||||
</main>
|
||||
);
|
||||
return <p>Bonjour {user.firstName}</p>;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { logoutAction } from "@/server/actions/auth";
|
||||
import { isActive } from "./nav";
|
||||
|
||||
const tab = "flex flex-1 flex-col items-center gap-0.5 py-2 text-[11px] font-medium";
|
||||
|
||||
export function MobileNav() {
|
||||
const pathname = usePathname();
|
||||
const [more, setMore] = useState(false);
|
||||
const color = (href: string) => (isActive(pathname, href) ? "text-accent" : "text-muted");
|
||||
|
||||
return (
|
||||
<>
|
||||
{more && (
|
||||
<div className="fixed inset-0 z-30 bg-black/20 md:hidden" onClick={() => setMore(false)}>
|
||||
<div className="absolute bottom-[72px] right-3 w-56 rounded-card border border-line bg-white p-2 shadow-lg">
|
||||
{[
|
||||
["/budgets", "◔ Budgets"],
|
||||
["/credits", "⌂ Crédits & charges"],
|
||||
["/reglages", "⚙ Réglages"],
|
||||
].map(([href, label]) => (
|
||||
<Link key={href} href={href} className="block rounded-lg px-3 py-2.5 font-medium hover:bg-page">
|
||||
{label}
|
||||
</Link>
|
||||
))}
|
||||
<span className="block px-3 py-2.5 text-gray-400">∿ Simulateur (bientôt)</span>
|
||||
<form action={logoutAction}>
|
||||
<button className="w-full rounded-lg px-3 py-2.5 text-left font-medium text-neg hover:bg-neg-soft">Déconnexion</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<nav className="fixed inset-x-0 bottom-0 z-40 flex items-end border-t border-line bg-white pb-[env(safe-area-inset-bottom)] md:hidden">
|
||||
<Link href="/" className={`${tab} ${color("/")}`}>
|
||||
<span className="text-lg">◧</span>Accueil
|
||||
</Link>
|
||||
<Link href="/operations" className={`${tab} ${color("/operations")}`}>
|
||||
<span className="text-lg">≡</span>Opérations
|
||||
</Link>
|
||||
<Link href="/nouvelle" className="flex flex-1 justify-center py-1.5" aria-label="Nouvelle opération">
|
||||
<span className="grid h-12 w-12 place-items-center rounded-full bg-accent text-2xl text-white shadow-md">+</span>
|
||||
</Link>
|
||||
<Link href="/recurrents" className={`${tab} ${color("/recurrents")}`}>
|
||||
<span className="text-lg">↻</span>Récurrents
|
||||
</Link>
|
||||
<button type="button" onClick={() => setMore((v) => !v)} className={`${tab} text-muted`}>
|
||||
<span className="text-lg">⋯</span>Plus
|
||||
</button>
|
||||
</nav>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { logoutAction } from "@/server/actions/auth";
|
||||
import { Logo } from "./Logo";
|
||||
import { Avatar } from "./ui/Avatar";
|
||||
import { Chip } from "./ui/Chip";
|
||||
import { NAV, isActive } from "./nav";
|
||||
|
||||
const item = "flex items-center gap-2.5 rounded-lg px-2.5 py-2 font-medium";
|
||||
|
||||
export function Sidebar({ user }: { user: { firstName: string; color: string } }) {
|
||||
const pathname = usePathname();
|
||||
return (
|
||||
<aside className="sticky top-0 hidden h-dvh w-[210px] shrink-0 flex-col border-r border-line bg-white px-3.5 py-[22px] md:flex">
|
||||
<div className="mb-[26px] px-2">
|
||||
<Logo />
|
||||
</div>
|
||||
<nav className="space-y-0.5">
|
||||
{NAV.map((n) =>
|
||||
n.soon ? (
|
||||
<span key={n.href} className={`${item} cursor-default text-gray-400`}>
|
||||
<span className="w-[18px] text-center">{n.icon}</span>
|
||||
{n.label}
|
||||
<span className="ml-auto">
|
||||
<Chip tone="planned">bientôt</Chip>
|
||||
</span>
|
||||
</span>
|
||||
) : (
|
||||
<Link
|
||||
key={n.href}
|
||||
href={n.href}
|
||||
className={`${item} ${isActive(pathname, n.href) ? "bg-accent-soft text-accent" : "text-muted hover:text-ink"}`}
|
||||
>
|
||||
<span className="w-[18px] text-center">{n.icon}</span>
|
||||
{n.label}
|
||||
</Link>
|
||||
),
|
||||
)}
|
||||
<Link
|
||||
href="/reglages"
|
||||
className={`${item} mt-6 ${isActive(pathname, "/reglages") ? "bg-accent-soft text-accent" : "text-muted hover:text-ink"}`}
|
||||
>
|
||||
<span className="w-[18px] text-center">⚙</span>
|
||||
Réglages
|
||||
</Link>
|
||||
</nav>
|
||||
<div className="mt-auto flex items-center gap-2 border-t border-line px-2 pt-4">
|
||||
<Avatar user={user} size={28} />
|
||||
<span className="font-semibold">{user.firstName}</span>
|
||||
<form action={logoutAction} className="ml-auto">
|
||||
<button className="text-xs text-muted hover:text-neg" title="Déconnexion">
|
||||
Déconnexion
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
export interface NavItem {
|
||||
href: string;
|
||||
label: string;
|
||||
icon: string;
|
||||
soon?: boolean;
|
||||
}
|
||||
|
||||
export const NAV: NavItem[] = [
|
||||
{ href: "/", label: "Tableau de bord", icon: "◧" },
|
||||
{ href: "/operations", label: "Opérations", icon: "≡" },
|
||||
{ href: "/recurrents", label: "Récurrents & prévu", icon: "↻" },
|
||||
{ href: "/budgets", label: "Budgets", icon: "◔" },
|
||||
{ href: "/credits", label: "Crédits & charges", icon: "⌂" },
|
||||
{ href: "/simulateur", label: "Simulateur", icon: "∿", soon: true },
|
||||
];
|
||||
|
||||
export const isActive = (pathname: string, href: string) =>
|
||||
href === "/" ? pathname === "/" : pathname === href || pathname.startsWith(`${href}/`);
|
||||
@@ -0,0 +1,13 @@
|
||||
import { formatEuro } from "@/domain/money";
|
||||
import type { OpKind } from "@/domain/types";
|
||||
|
||||
/** Montant en vert (entrée) ou rouge (dépense), chiffres tabulaires. */
|
||||
export function Amount({ cents, kind, className = "" }: { cents: number; kind?: OpKind; className?: string }) {
|
||||
const signed = kind === "EXPENSE" ? -cents : cents;
|
||||
const color = kind === "INCOME" ? "text-pos" : kind === "EXPENSE" ? "text-neg" : "";
|
||||
return (
|
||||
<span className={`tabular whitespace-nowrap font-semibold ${color} ${className}`}>
|
||||
{formatEuro(signed, { sign: kind !== undefined })}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export function Avatar({ user, size = 34 }: { user: { firstName: string; color: string }; size?: number }) {
|
||||
return (
|
||||
<span
|
||||
className="inline-grid shrink-0 place-items-center rounded-full font-bold text-white"
|
||||
style={{ backgroundColor: user.color, width: size, height: size, fontSize: size * 0.38 }}
|
||||
>
|
||||
{user.firstName.slice(0, 1).toUpperCase()}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
type Tone = "accent" | "split" | "planned" | "link" | "danger";
|
||||
|
||||
const TONES: Record<Tone, string> = {
|
||||
accent: "bg-accent-soft text-accent",
|
||||
split: "bg-gray-100 text-gray-700",
|
||||
planned: "bg-warn-soft text-warn",
|
||||
link: "bg-pos-soft text-pos",
|
||||
danger: "bg-neg-soft text-neg",
|
||||
};
|
||||
|
||||
/** Pastille ; `color` (couleur d'une personne) remplace le ton. */
|
||||
export function Chip({ tone = "accent", color, children }: { tone?: Tone; color?: string; children: ReactNode }) {
|
||||
const style = color ? { backgroundColor: `${color}1a`, color } : undefined;
|
||||
return (
|
||||
<span
|
||||
className={`inline-block whitespace-nowrap rounded-full px-2 py-0.5 text-[11px] font-semibold ${color ? "" : TONES[tone]}`}
|
||||
style={style}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import Link from "next/link";
|
||||
import { addMonths, monthLabelFr } from "@/lib/dates";
|
||||
|
||||
/** ‹ Mois › : navigation par le paramètre ?m=YYYY-MM, en conservant les autres filtres. */
|
||||
export function MonthSwitcher({
|
||||
month,
|
||||
basePath,
|
||||
params = {},
|
||||
}: {
|
||||
month: string;
|
||||
basePath: string;
|
||||
params?: Record<string, string | undefined>;
|
||||
}) {
|
||||
const href = (m: string) => {
|
||||
const q = new URLSearchParams({ ...Object.fromEntries(Object.entries(params).filter(([, v]) => v)), m } as Record<string, string>);
|
||||
return `${basePath}?${q}`;
|
||||
};
|
||||
const arrow = "grid h-[30px] w-[30px] place-items-center rounded-lg border border-line bg-white text-muted hover:text-ink";
|
||||
return (
|
||||
<div className="flex items-center gap-3">
|
||||
<Link href={href(addMonths(month, -1))} className={arrow} aria-label="Mois précédent">
|
||||
‹
|
||||
</Link>
|
||||
<h1 className="min-w-[10ch] text-center text-xl font-bold md:text-[22px]">{monthLabelFr(month)}</h1>
|
||||
<Link href={href(addMonths(month, 1))} className={arrow} aria-label="Mois suivant">
|
||||
›
|
||||
</Link>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
"use client";
|
||||
|
||||
export interface PillOption<T extends string> {
|
||||
value: T;
|
||||
label: string;
|
||||
}
|
||||
|
||||
export function Pills<T extends string>({
|
||||
options,
|
||||
value,
|
||||
onChange,
|
||||
}: {
|
||||
options: PillOption<T>[];
|
||||
value: T | null;
|
||||
onChange: (v: T) => void;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{options.map((o) => (
|
||||
<button
|
||||
key={o.value}
|
||||
type="button"
|
||||
onClick={() => onChange(o.value)}
|
||||
className={`rounded-full border px-3 py-1.5 text-[13px] font-medium transition-colors ${
|
||||
value === o.value ? "border-accent bg-accent text-white" : "border-line bg-white text-ink hover:border-gray-300"
|
||||
}`}
|
||||
>
|
||||
{o.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import type { Operation, OperationSplit, Recurring, RecurringSplit, Settlement as SettlementRow } from "@prisma/client";
|
||||
import { centsFromDecimal } from "@/domain/money";
|
||||
import type { RecurringDef } from "@/domain/recurrence";
|
||||
import type { Op, Settlement, Split } from "@/domain/types";
|
||||
import { toIsoDate } from "@/lib/dates";
|
||||
|
||||
export const splitOf = (rows: { userId: string; basisPoints: number }[]): Split =>
|
||||
Object.fromEntries(rows.map((s) => [s.userId, s.basisPoints]));
|
||||
|
||||
export const splitRows = (split: Split) =>
|
||||
Object.entries(split).map(([userId, basisPoints]) => ({ userId, basisPoints }));
|
||||
|
||||
export function toOp(row: Operation & { splits: OperationSplit[] }): Op {
|
||||
return {
|
||||
id: row.id,
|
||||
kind: row.kind,
|
||||
amount: centsFromDecimal(row.amount),
|
||||
date: toIsoDate(row.date),
|
||||
label: row.label,
|
||||
categoryId: row.categoryId,
|
||||
accountUserId: row.accountUserId,
|
||||
status: row.status,
|
||||
split: splitOf(row.splits),
|
||||
recurringId: row.recurringId,
|
||||
allocatedToRecurringId: row.allocatedToRecurringId,
|
||||
allocatedToOperationId: row.allocatedToOperationId,
|
||||
allocationMode: row.allocationMode,
|
||||
};
|
||||
}
|
||||
|
||||
export function toRecurringDef(row: Recurring & { splits: RecurringSplit[] }): RecurringDef {
|
||||
return {
|
||||
id: row.id,
|
||||
kind: row.kind,
|
||||
amount: centsFromDecimal(row.amount),
|
||||
label: row.label,
|
||||
categoryId: row.categoryId,
|
||||
accountUserId: row.accountUserId,
|
||||
split: splitOf(row.splits),
|
||||
frequency: row.frequency,
|
||||
dayOfMonth: row.dayOfMonth,
|
||||
startDate: toIsoDate(row.startDate),
|
||||
endDate: row.endDate ? toIsoDate(row.endDate) : null,
|
||||
paused: row.paused,
|
||||
allocatedToRecurringId: row.allocatedToRecurringId,
|
||||
allocationMode: row.allocationMode,
|
||||
};
|
||||
}
|
||||
|
||||
export function toSettlement(row: SettlementRow): Settlement {
|
||||
return {
|
||||
id: row.id,
|
||||
fromUserId: row.fromUserId,
|
||||
toUserId: row.toUserId,
|
||||
amount: centsFromDecimal(row.amount),
|
||||
date: toIsoDate(row.date),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import type { OpKind } from "@prisma/client";
|
||||
import { addMonths, fromIsoDate } from "@/lib/dates";
|
||||
import type { RecurringDef } from "@/domain/recurrence";
|
||||
import type { Op, Settlement, Split } from "@/domain/types";
|
||||
import { prisma } from "./db";
|
||||
import { toOp, toRecurringDef, toSettlement } from "./mappers";
|
||||
|
||||
export interface UserLite {
|
||||
id: string;
|
||||
firstName: string;
|
||||
color: string;
|
||||
}
|
||||
|
||||
export async function getUsers(): Promise<UserLite[]> {
|
||||
return prisma.user.findMany({ select: { id: true, firstName: true, color: true }, orderBy: { createdAt: "asc" } });
|
||||
}
|
||||
|
||||
export async function getCategories(kind?: OpKind, includeArchived = false) {
|
||||
return prisma.category.findMany({
|
||||
where: { ...(kind ? { kind } : {}), ...(includeArchived ? {} : { archived: false }) },
|
||||
orderBy: [{ kind: "desc" }, { sortOrder: "asc" }, { name: "asc" }],
|
||||
});
|
||||
}
|
||||
|
||||
export async function getOpsBetween(from: string, toExclusive: string): Promise<Op[]> {
|
||||
const rows = await prisma.operation.findMany({
|
||||
where: { date: { gte: fromIsoDate(from), lt: fromIsoDate(toExclusive) } },
|
||||
include: { splits: true },
|
||||
orderBy: [{ date: "desc" }, { createdAt: "desc" }],
|
||||
});
|
||||
return rows.map(toOp);
|
||||
}
|
||||
|
||||
export async function getOpsForMonth(month: string): Promise<Op[]> {
|
||||
return getOpsBetween(`${month}-01`, `${addMonths(month, 1)}-01`);
|
||||
}
|
||||
|
||||
export async function getAllActualOps(): Promise<Op[]> {
|
||||
const rows = await prisma.operation.findMany({ where: { status: "ACTUAL" }, include: { splits: true } });
|
||||
return rows.map(toOp);
|
||||
}
|
||||
|
||||
export async function getSettlements(): Promise<Settlement[]> {
|
||||
const rows = await prisma.settlement.findMany({ orderBy: { date: "desc" } });
|
||||
return rows.map(toSettlement);
|
||||
}
|
||||
|
||||
export async function getRecurringDefs(): Promise<RecurringDef[]> {
|
||||
const rows = await prisma.recurring.findMany({ include: { splits: true }, orderBy: { label: "asc" } });
|
||||
return rows.map(toRecurringDef);
|
||||
}
|
||||
|
||||
export async function getDefaultSplit(): Promise<Split> {
|
||||
const setting = await prisma.setting.findUnique({ where: { id: 1 } });
|
||||
return (setting?.defaultSplit ?? {}) as Split;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import { Prisma } from "@prisma/client";
|
||||
import { occurrenceKey, planOccurrences } from "@/domain/recurrence";
|
||||
import { decimalFromCents } from "@/domain/money";
|
||||
import { fromIsoDate, todayParis, toIsoDate } from "@/lib/dates";
|
||||
import { prisma } from "./db";
|
||||
import { splitRows } from "./mappers";
|
||||
import { getRecurringDefs, getUsers } from "./repo";
|
||||
|
||||
/**
|
||||
* Matérialise les occurrences prévues des récurrents sur 12 mois glissants (spec §9).
|
||||
* Idempotent : appelé à chaque chargement de page, sans cron.
|
||||
*/
|
||||
export async function syncRecurrings(today: string = todayParis()): Promise<number> {
|
||||
const [defs, users] = await Promise.all([getRecurringDefs(), getUsers()]);
|
||||
if (defs.length === 0) return 0;
|
||||
|
||||
const existing = await prisma.operation.findMany({
|
||||
where: { recurringId: { not: null }, occurrenceDate: { not: null } },
|
||||
select: { recurringId: true, occurrenceDate: true },
|
||||
});
|
||||
const keys = new Set(existing.map((e) => occurrenceKey(e.recurringId!, toIsoDate(e.occurrenceDate!))));
|
||||
|
||||
let created = 0;
|
||||
for (const p of planOccurrences(defs, keys, today, users.map((u) => u.id))) {
|
||||
try {
|
||||
await prisma.operation.create({
|
||||
data: {
|
||||
kind: p.kind,
|
||||
amount: decimalFromCents(p.amount),
|
||||
date: fromIsoDate(p.date),
|
||||
occurrenceDate: fromIsoDate(p.occurrenceDate),
|
||||
label: p.label,
|
||||
categoryId: p.categoryId,
|
||||
accountUserId: p.accountUserId,
|
||||
createdById: p.accountUserId,
|
||||
status: "PLANNED",
|
||||
recurringId: p.recurringId,
|
||||
allocatedToRecurringId: p.allocatedToRecurringId,
|
||||
allocationMode: p.allocationMode,
|
||||
splits: { create: splitRows(p.split) },
|
||||
},
|
||||
});
|
||||
created += 1;
|
||||
} catch (e) {
|
||||
// Deux chargements simultanés : l'occurrence existe déjà, on ignore.
|
||||
if (!(e instanceof Prisma.PrismaClientKnownRequestError && e.code === "P2002")) throw e;
|
||||
}
|
||||
}
|
||||
return created;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { fromIsoDate } from "@/lib/dates";
|
||||
import { prisma } from "@/server/db";
|
||||
import { syncRecurrings } from "@/server/sync";
|
||||
import { categoryId, makeUsers, resetDb } from "./helpers";
|
||||
|
||||
async function makeRent() {
|
||||
const { h, c } = await makeUsers();
|
||||
const rent = await prisma.recurring.create({
|
||||
data: {
|
||||
kind: "EXPENSE",
|
||||
amount: "1000.00",
|
||||
label: "Loyer",
|
||||
categoryId: await categoryId("Logement"),
|
||||
accountUserId: h.id,
|
||||
frequency: "MONTHLY",
|
||||
dayOfMonth: 5,
|
||||
startDate: fromIsoDate("2026-01-05"),
|
||||
splits: { create: [{ userId: h.id, basisPoints: 5000 }, { userId: c.id, basisPoints: 5000 }] },
|
||||
},
|
||||
});
|
||||
return { h, c, rent };
|
||||
}
|
||||
|
||||
describe("syncRecurrings", () => {
|
||||
beforeEach(resetDb);
|
||||
|
||||
it("creates 12 months of planned occurrences with splits, idempotently", async () => {
|
||||
const { rent } = await makeRent();
|
||||
expect(await syncRecurrings("2026-10-27")).toBe(12);
|
||||
expect(await syncRecurrings("2026-10-27")).toBe(0);
|
||||
const first = await prisma.operation.findFirstOrThrow({
|
||||
where: { recurringId: rent.id },
|
||||
orderBy: { date: "asc" },
|
||||
include: { splits: true },
|
||||
});
|
||||
expect(first.date.toISOString().slice(0, 10)).toBe("2026-10-05");
|
||||
expect(first.status).toBe("PLANNED");
|
||||
expect(first.splits.map((s) => s.basisPoints)).toEqual([5000, 5000]);
|
||||
});
|
||||
|
||||
it("recreates deleted occurrences but never skipped ones", async () => {
|
||||
const { rent } = await makeRent();
|
||||
await syncRecurrings("2026-10-27");
|
||||
await prisma.operation.updateMany({
|
||||
where: { recurringId: rent.id, date: fromIsoDate("2026-10-05") },
|
||||
data: { status: "SKIPPED" },
|
||||
});
|
||||
await prisma.operation.deleteMany({ where: { recurringId: rent.id, date: fromIsoDate("2026-11-05") } });
|
||||
expect(await syncRecurrings("2026-10-27")).toBe(1);
|
||||
const october = await prisma.operation.findFirstOrThrow({ where: { recurringId: rent.id, date: fromIsoDate("2026-10-05") } });
|
||||
expect(october.status).toBe("SKIPPED");
|
||||
});
|
||||
|
||||
it("keeps actual history when the recurring template is deleted", async () => {
|
||||
const { rent } = await makeRent();
|
||||
await syncRecurrings("2026-10-27");
|
||||
const october = await prisma.operation.findFirstOrThrow({ where: { recurringId: rent.id, date: fromIsoDate("2026-10-05") } });
|
||||
await prisma.operation.update({ where: { id: october.id }, data: { status: "ACTUAL" } });
|
||||
await prisma.operation.deleteMany({ where: { recurringId: rent.id, status: "PLANNED" } });
|
||||
await prisma.recurring.delete({ where: { id: rent.id } });
|
||||
const kept = await prisma.operation.findUniqueOrThrow({ where: { id: october.id } });
|
||||
expect(kept.recurringId).toBeNull();
|
||||
expect(kept.status).toBe("ACTUAL");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user