Skip to content

Commit 2b72319

Browse files
committed
chore: update to latest ZenStack
1 parent af3c6f9 commit 2b72319

File tree

3 files changed

+79
-104
lines changed

3 files changed

+79
-104
lines changed

package-lock.json

+76-76
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"@trpc/next": "^11.0.0-rc.502",
2828
"@trpc/react-query": "^11.0.0-rc.502",
2929
"@trpc/server": "^11.0.0-rc.502",
30-
"@zenstackhq/runtime": "^2.7.5",
31-
"@zenstackhq/trpc": "^2.7.5",
30+
"@zenstackhq/runtime": "^2.8.0",
31+
"@zenstackhq/trpc": "^2.8.0",
3232
"babel-plugin-superjson-next": "^0.4.5",
3333
"bcryptjs": "^2.4.3",
3434
"cross-env": "^7.0.3",
@@ -56,6 +56,6 @@
5656
"prisma": "^5.20.0",
5757
"tailwindcss": "^3.1.8",
5858
"typescript": "^5.3.2",
59-
"zenstack": "^2.7.5"
59+
"zenstack": "^2.8.0"
6060
}
6161
}

prisma/schema.prisma

-25
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,16 @@ enum SpaceUserRole {
1818
ADMIN
1919
}
2020

21-
/// @@deny('all', auth() == null)
22-
/// @@allow('create', true)
23-
/// @@allow('read', members?[user == auth()])
24-
/// @@allow('update,delete', members?[user == auth() && role == ADMIN])
2521
model Space {
2622
id String @id() @default(uuid())
2723
createdAt DateTime @default(now())
2824
updatedAt DateTime @updatedAt()
29-
/// @length(4, 50)
3025
name String
31-
/// @regex('^[0-9a-zA-Z]{4,16}$')
3226
slug String @unique()
3327
members SpaceUser[]
3428
lists List[]
3529
}
3630

37-
/// @@deny('all', auth() == null)
38-
/// @@allow('create,update,delete', space.members?[user == auth() && role == ADMIN])
39-
/// @@allow('read', space.members?[user == auth()])
4031
model SpaceUser {
4132
id String @id() @default(uuid())
4233
createdAt DateTime @default(now())
@@ -50,33 +41,21 @@ model SpaceUser {
5041
@@unique([userId, spaceId])
5142
}
5243

53-
/// @@allow('create', true)
54-
/// @@allow('read', spaces?[space.members?[user == auth()]])
55-
/// @@allow('all', auth() == this)
5644
model User {
5745
id String @id() @default(uuid())
5846
createdAt DateTime @default(now())
5947
updatedAt DateTime @updatedAt()
60-
/// @email
6148
email String @unique()
6249
emailVerified DateTime?
63-
/// @password
64-
/// @omit
6550
password String?
6651
name String?
6752
spaces SpaceUser[]
68-
/// @url
6953
image String?
7054
lists List[]
7155
todos Todo[]
7256
accounts Account[]
7357
}
7458

75-
/// @@deny('all', auth() == null)
76-
/// @@allow('read', owner == auth() || (space.members?[user == auth()] && !private))
77-
/// @@allow('create', owner == auth() && space.members?[user == auth()])
78-
/// @@allow('update', owner == auth() && space.members?[user == auth()] && future().owner == owner)
79-
/// @@allow('delete', owner == auth())
8059
model List {
8160
id String @id() @default(uuid())
8261
createdAt DateTime @default(now())
@@ -85,14 +64,11 @@ model List {
8564
spaceId String
8665
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
8766
ownerId String
88-
/// @length(1, 100)
8967
title String
9068
private Boolean @default(false)
9169
todos Todo[]
9270
}
9371

94-
/// @@allow('all', check(list, 'read'))
95-
/// @@deny('update', future().owner != owner)
9672
model Todo {
9773
id String @id() @default(uuid())
9874
createdAt DateTime @default(now())
@@ -101,7 +77,6 @@ model Todo {
10177
ownerId String
10278
list List @relation(fields: [listId], references: [id], onDelete: Cascade)
10379
listId String
104-
/// @length(1, 100)
10580
title String
10681
completedAt DateTime?
10782
}

0 commit comments

Comments
 (0)