-
-
Notifications
You must be signed in to change notification settings - Fork 19
Closed
Description
ZModel:
type AuthInfo {
aProperty Boolean
@@auth
}
type Foo {
bar String
baz Int
@@allow("all", auth().aProperty)
}
model JsonArrayRoot {
id String @id @default(cuid())
fields JsonArrayField[]
@@allow("all", auth().aProperty)
}
model JsonArrayField {
id String @id @default(cuid())
data Foo[] @json
rootId String
root JsonArrayRoot @relation(fields: [rootId], references: [id])
@@allow("all", auth().aProperty)
}TS:
const db = new ZenStackClient(schema, {
...,
plugins: [
{
id: 'foo',
name: 'foo',
description: 'foo',
onEntityMutation: {
afterEntityMutation: async () => Promise.resolve(),
beforeEntityMutation: async () => Promise.resolve(),
runAfterMutationWithinTransaction: true,
},
},
],
});
const authed = db.$setAuth({ aProperty: true });
const root = await authed.jsonArrayRoot.create({ data: {} });
const created = await authed.jsonArrayField.create({
data: {
data: [],
rootId: root.id,
},
});
const updateData = [
{ bar: 'hello', baz: 1 },
{ bar: 'world', baz: 2 },
];
await authed.jsonArrayField.update({
where: { id: created.id },
data: {
data: updateData,
rootId: root.id,
},
});Error:
Invalid array filter key: 0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels