Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finished FDC Quickstart #95

Open
wants to merge 18 commits into
base: rpf-add-data-connect-sample
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dataconnect/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
Expand Down Expand Up @@ -41,3 +43,5 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

/lib/firebase_options.dart
1 change: 1 addition & 0 deletions dataconnect/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<application
android:label="dataconnect"
android:name="${applicationName}"
android:networkSecurityConfig="@xml/network_security_config"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain>10.0.2.2</domain>
</domain-config>
</network-security-config>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
connectorId: movies
generate:
dartSdk:
outputDir: ../lib/movies_connector
outputDir: ../../lib/movies_connector
package: movies_connector
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
mutation UpsertUser($username: String!) @auth(level: USER) {
mutation UpsertUser($username: String!, $name: String!) @auth(level: USER) {
user_upsert(
data: {
id_expr: "auth.uid"
username: $username
name: $name
}
)
}
Expand All @@ -20,7 +21,7 @@ mutation DeleteFavoritedMovie($movieId: UUID!) @auth(level: USER) {
# Add a review for a movie
mutation AddReview($movieId: UUID!, $rating: Int!, $reviewText: String!)
@auth(level: USER) {
review_insert(
review_upsert(
data: {
userId_expr: "auth.uid"
movieId: $movieId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,32 @@ query ListMovies($orderByRating: OrderDirection, $orderByReleaseYear: OrderDirec
description
}
}
query ListMoviesByGenre($genre: String!, $orderByRating: OrderDirection, $orderByReleaseYear: OrderDirection, $limit: Int) @auth(level: PUBLIC) {
movies(where: {
genre: {
eq: $genre
}
}, orderBy: [
{ rating: $orderByRating },
{ releaseYear: $orderByReleaseYear }
]
limit: $limit) {
id
title
imageUrl
releaseYear
genre
rating
tags
description
}
}

query ListGenres @auth(level: PUBLIC) {
genres {
genre
}
}

# Get movie by id
query GetMovieById($id: UUID!) @auth(level: PUBLIC) {
Expand Down Expand Up @@ -88,6 +114,7 @@ query GetCurrentUser @auth(level: USER) {
user(key: { id_expr: "auth.uid" }) {
id
username
name
reviews: reviews_on_user {
id
rating
Expand Down Expand Up @@ -116,12 +143,13 @@ query GetCurrentUser @auth(level: USER) {
}
}

query GetIfFavoritedMovie($movieId: UUID!) @auth(level: USER) {
query GetMovieInfoForUser($movieId: UUID!) @auth(level: USER) {
favorite_movie(key: { userId_expr: "auth.uid", movieId: $movieId }) {
movieId
}
}


# Search for movies, actors, and reviews
query SearchAll(
$input: String
Expand Down Expand Up @@ -210,16 +238,16 @@ query SearchAll(

# # The queries below are unused by the application, but are useful examples for more complex cases

# # List movies by partial title match
# query ListMoviesByPartialTitle($input: String!) @auth(level: PUBLIC) {
# movies(where: { title: { contains: $input } }) {
# id
# title
# genre
# rating
# imageUrl
# }
# }
# List movies by partial title match
query ListMoviesByPartialTitle($input: String!) @auth(level: PUBLIC) {
movies(where: { title: { contains: $input } }) {
id
title
genre
rating
imageUrl
}
}

# # List movies by tag
# query ListMoviesByTag($tag: String!) @auth(level: PUBLIC) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ schema:
source: "./schema"
datasource:
postgresql:
database: "fdcdb2"
database: "fdcdb"
cloudSql:
instanceId: "fdc-sql"
instanceId: "dataconnect-fdc"
# schemaValidation: "COMPATIBLE"
connectorDirs: ["./connector"]
Loading
Loading