refactor: better shortcut hook

This commit is contained in:
Max Koon
2025-12-05 17:05:23 -05:00
parent 2df7f2d924
commit 76f2a43bd0
21 changed files with 481 additions and 143 deletions

View File

@@ -1,5 +1,5 @@
import type { Transaction } from "@rocicorp/zero";
import type { AuthData } from "./auth";
import { authDataSchema, type AuthData } from "./auth";
import { type Schema } from "./zero-schema.gen";
import { isLoggedIn } from "./zql";
@@ -39,6 +39,17 @@ export function createMutators(authData: AuthData | null) {
}
},
},
budget: {
async create(tx: Tx, { id }: { id: string }) {
isLoggedIn(authData);
await tx.mutate.budget.insert({
id,
orgId: authData.user.id,
label: "New Budget",
createdBy: authData.user.id,
});
},
},
} as const;
}