feat: use uuid
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user