File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
dataconnect/dataconnect/movie-connector Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,8 @@ mutation CreateMovie(
7
7
$description : String
8
8
$imageUrl : String !
9
9
$tags : [String ! ] = []
10
- ) @auth (level : USER_EMAIL_VERIFIED ) {
10
+ ) @auth (expr : " auth.token.isAdmin == true" ) {
11
+ builders ($tenantId : String !) {
11
12
movie_insert (
12
13
data : {
13
14
title : $title
@@ -47,7 +48,27 @@ mutation AddReview(
47
48
$rating : Int !
48
49
$reviewText : String !
49
50
) @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 ,
51
72
data : {
52
73
userId_expr : " auth.uid"
53
74
movieId : $movieId
Original file line number Diff line number Diff line change 3
3
"version" : " 0.0.0" ,
4
4
"scripts" : {
5
5
"ng" : " ng" ,
6
- "start" : " npm run pre-build && firebase --project demo-friendly-eats emulators:exec --import ./app-data-seed --ui ' ng serve' " ,
7
- "emulators" : " npm run pre-build && firebase --project demo-friendly-eats emulators:exec --import ./app-data-seed --ui ' ng serve -c local' " ,
6
+ "start" : " npm run pre-build && firebase --project demo-friendly-eats emulators:exec --import ./app-data-seed --ui \" ng serve\" " ,
7
+ "emulators" : " npm run pre-build && firebase --project demo-friendly-eats emulators:exec --import ./app-data-seed --ui \" ng serve -c local\" " ,
8
8
"production" : " npm run pre-build && firebase deploy --only firestore && npm run check-config" ,
9
9
"check-config" :" grep -q \" projectId\" \" src/environments/environment.prod.ts\" && ng serve -c production || echo \" No project id in configuration file!\" " ,
10
10
"pre-build" : " (cd functions && npm run build)" ,
You can’t perform that action at this time.
0 commit comments