Skip to content

Commit 0fa3296

Browse files
author
Frank
committed
sync
1 parent c6693f6 commit 0fa3296

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
1-
import { Zero } from "@rocicorp/zero";
2-
import { useParams } from "@solidjs/router";
3-
import { schema } from "@opencontrol/zero/schema";
4-
import { createInitializedContext } from "../../util/context";
5-
import { useOpenAuth } from "@openauthjs/solid";
6-
import { useAccount } from "../../components/context-account";
7-
import { useWorkspace } from "./context-workspace";
1+
import { Zero } from "@rocicorp/zero"
2+
import { useParams } from "@solidjs/router"
3+
import { schema } from "@opencontrol/zero/schema"
4+
import { createInitializedContext } from "../../util/context"
5+
import { useOpenAuth } from "@openauthjs/solid"
6+
import { useAccount } from "../../components/context-account"
7+
import { useWorkspace } from "./context-workspace"
88

99
export const { use: useZero, provider: ZeroProvider } =
1010
createInitializedContext("ZeroContext", () => {
1111
const workspace = useWorkspace()
12-
const auth = useOpenAuth();
13-
const account = useAccount();
12+
const auth = useOpenAuth()
13+
const account = useAccount()
1414
const zero = new Zero({
1515
auth: auth.access,
1616
server: import.meta.env.VITE_ZERO_URL,
1717
userID: account.current!.email,
1818
storageKey: workspace.id,
1919
schema,
20-
});
20+
})
2121

2222
zero.query.user.where("workspace_id", workspace.id).preload({
2323
ttl: "forever",
2424
})
2525
zero.query.workspace.where("id", workspace.id).preload({
2626
ttl: "forever",
2727
})
28+
zero.query.aws_account.where("workspace_id", workspace.id).preload({
29+
ttl: "forever",
30+
})
2831

2932
return {
3033
mutate: zero.mutate,
3134
query: zero.query,
3235
ready: true,
33-
};
34-
});
35-
36+
}
37+
})

app/zero/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export const schema = createSchema({
6969
})),
7070
relationships(aws_account, (r) => ({
7171
users: r.many({
72-
sourceField: ["id"],
72+
sourceField: ["workspace_id"],
7373
destSchema: user,
7474
destField: ["workspace_id"],
7575
}),

0 commit comments

Comments
 (0)