feat: use uuid

This commit is contained in:
Max Koon
2025-10-14 20:52:53 -04:00
parent b960536801
commit f4170f2d8a
5 changed files with 11 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
import type { Transaction } from "@rocicorp/zero";
import type { AuthData } from "./auth";
import type { Schema } from "./schema";
import type { Schema } from ".";
import { isLoggedIn } from "./zql";
type Tx = Transaction<Schema>;
@@ -8,10 +8,10 @@ type Tx = Transaction<Schema>;
export function createMutators(authData: AuthData | null) {
return {
transaction: {
async create(tx: Tx, { name, amount }: { name: string, amount: number }) {
async create(tx: Tx, { id, name, amount }: { id: string, name: string, amount: number }) {
isLoggedIn(authData);
await tx.mutate.transaction.insert({
id: 'id-' + Math.random().toString(),
id,
user_id: authData.user.id,
name,
amount,