Skip to content

Commit 850bd28

Browse files
authored
Merge branch 'master' into fdc-quickstart-readme
2 parents 90f3b46 + 0a8a680 commit 850bd28

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
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

firestore/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "0.0.0",
44
"scripts": {
55
"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\"",
88
"production": "npm run pre-build && firebase deploy --only firestore && npm run check-config",
99
"check-config":"grep -q \"projectId\" \"src/environments/environment.prod.ts\" && ng serve -c production || echo \"No project id in configuration file!\"",
1010
"pre-build": "(cd functions && npm run build)",

0 commit comments

Comments
 (0)