Skip to content

Commit 0a8a680

Browse files
committed
fix: dataconnect @auth
1 parent 95d87de commit 0a8a680

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

dataconnect/dataconnect/movie-connector/mutations.gql

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ mutation CreateMovie(
77
$description: String
88
$imageUrl: String!
99
$tags: [String!] = []
10-
) @auth(level: USER_EMAIL_VERIFIED) {
10+
) @auth(expr: "auth.token.isAdmin == true") {
11+
builders($tenantId: String!) {
1112
movie_insert(
1213
data: {
1314
title: $title
@@ -47,7 +48,27 @@ mutation AddReview(
4748
$rating: Int!
4849
$reviewText: String!
4950
) @auth(level: USER) {
50-
review_upsert(
51+
review_update(
52+
data: {
53+
userId_expr: "auth.uid"
54+
movieId: $movieId
55+
rating: $rating
56+
reviewText: $reviewText
57+
reviewDate_date: { today: true }
58+
}
59+
)
60+
}
61+
62+
# Update a user's review for a movie
63+
mutation UpdateReview(
64+
$id: UUID!
65+
$movieId: UUID!
66+
$rating: Int!
67+
$reviewText: String!
68+
$userId: String!
69+
) @auth(expr: "auth.uid != null && auth.uid == userId") {
70+
review_update(
71+
id: $id,
5172
data: {
5273
userId_expr: "auth.uid"
5374
movieId: $movieId

0 commit comments

Comments
 (0)