24 lines
856 B
TypeScript
24 lines
856 B
TypeScript
if (process.env.NODE_ENV !== "test")
|
|
require("server-only");
|
|
import { createEntry, deleteEntry, listEntries, updateEntry, requireActiveGroup } from "@/lib/server/entries";
|
|
import type { Entry } from "@/lib/shared/types";
|
|
|
|
export { requireActiveGroup };
|
|
|
|
export async function listRecurringEntries(groupId: number): Promise<Entry[]> {
|
|
const entries = await listEntries(groupId);
|
|
return entries.filter(entry => entry.isRecurring);
|
|
}
|
|
|
|
export async function createRecurringEntry(input: Parameters<typeof createEntry>[0]) {
|
|
return createEntry({ ...input, isRecurring: true });
|
|
}
|
|
|
|
export async function updateRecurringEntry(input: Parameters<typeof updateEntry>[0]) {
|
|
return updateEntry({ ...input, isRecurring: true });
|
|
}
|
|
|
|
export async function deleteRecurringEntry(input: { id: number; groupId: number }) {
|
|
return deleteEntry(input);
|
|
}
|