mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-12 17:22:38 +02:00
chore: prepare cloud merge point with docker and firebase configs in movexe fork Boris account? No, current user.
This commit is contained in:
parent
b38a297349
commit
4a6b335ce3
14 changed files with 263 additions and 2 deletions
11
dataconnect/dataconnect.yaml
Normal file
11
dataconnect/dataconnect.yaml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
specVersion: "v1"
|
||||
serviceId: "surfsense-db"
|
||||
location: "us-east4"
|
||||
schemas:
|
||||
- source: "./schema"
|
||||
datasource:
|
||||
postgresql:
|
||||
database: "fdcdb"
|
||||
cloudSql:
|
||||
instanceId: "surfsense-db-fdc"
|
||||
connectorDirs: ["./example"]
|
||||
9
dataconnect/example/connector.yaml
Normal file
9
dataconnect/example/connector.yaml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
connectorId: example
|
||||
generate:
|
||||
javascriptSdk:
|
||||
- outputDir: ..\..\..\..\Antigravity\resources\app\src\dataconnect-generated
|
||||
package: "@dataconnect/generated"
|
||||
packageJsonDir: ..\..\..\..\Antigravity\resources\app
|
||||
react: true
|
||||
angular: false
|
||||
clientCache: {}
|
||||
24
dataconnect/example/mutations.gql
Normal file
24
dataconnect/example/mutations.gql
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
mutation CreateMovie($title: String!, $genre: String!, $imageUrl: String!)
|
||||
@auth(level: USER_EMAIL_VERIFIED, insecureReason: "Any email verified users can create a new movie.") {
|
||||
movie_insert(data: { title: $title, genre: $genre, imageUrl: $imageUrl })
|
||||
}
|
||||
|
||||
mutation UpsertUser($username: String!) @auth(level: USER) {
|
||||
user_upsert(data: { id_expr: "auth.uid", username: $username })
|
||||
}
|
||||
|
||||
mutation AddReview($movieId: UUID!, $rating: Int!, $reviewText: String!)
|
||||
@auth(level: USER) {
|
||||
review_upsert(
|
||||
data: {
|
||||
userId_expr: "auth.uid"
|
||||
movieId: $movieId
|
||||
rating: $rating
|
||||
reviewText: $reviewText
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
mutation DeleteReview($movieId: UUID!) @auth(level: USER) {
|
||||
review_delete(key: { userId_expr: "auth.uid", movieId: $movieId })
|
||||
}
|
||||
67
dataconnect/example/queries.gql
Normal file
67
dataconnect/example/queries.gql
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
query ListMovies @auth(level: PUBLIC, insecureReason: "Anyone can list all movies.") {
|
||||
movies {
|
||||
id
|
||||
title
|
||||
imageUrl
|
||||
genre
|
||||
}
|
||||
}
|
||||
|
||||
query ListUsers @auth(level: NO_ACCESS) {
|
||||
users {
|
||||
id
|
||||
username
|
||||
}
|
||||
}
|
||||
|
||||
query ListUserReviews @auth(level: USER) {
|
||||
user(key: { id_expr: "auth.uid" }) {
|
||||
id
|
||||
username
|
||||
reviews: reviews_on_user {
|
||||
rating
|
||||
reviewDate
|
||||
reviewText
|
||||
movie {
|
||||
id
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query GetMovieById($id: UUID!) @auth(level: PUBLIC, insecureReason: "Anyone can get a movie by id.") {
|
||||
movie(id: $id) {
|
||||
id
|
||||
title
|
||||
imageUrl
|
||||
genre
|
||||
metadata: movieMetadata_on_movie {
|
||||
rating
|
||||
releaseYear
|
||||
description
|
||||
}
|
||||
reviews: reviews_on_movie {
|
||||
reviewText
|
||||
reviewDate
|
||||
rating
|
||||
user {
|
||||
id
|
||||
username
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query SearchMovie($titleInput: String, $genre: String) @auth(level: PUBLIC, insecureReason: "Anyone can search for movies.") {
|
||||
movies(
|
||||
where: {
|
||||
_and: [{ genre: { eq: $genre } }, { title: { contains: $titleInput } }]
|
||||
}
|
||||
) {
|
||||
id
|
||||
title
|
||||
genre
|
||||
imageUrl
|
||||
}
|
||||
}
|
||||
25
dataconnect/schema/schema.gql
Normal file
25
dataconnect/schema/schema.gql
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
type User @table {
|
||||
id: String! @default(expr: "auth.uid")
|
||||
username: String! @col(dataType: "varchar(50)")
|
||||
}
|
||||
|
||||
type Movie @table {
|
||||
title: String!
|
||||
imageUrl: String!
|
||||
genre: String
|
||||
}
|
||||
|
||||
type MovieMetadata @table {
|
||||
movie: Movie! @unique
|
||||
rating: Float
|
||||
releaseYear: Int
|
||||
description: String
|
||||
}
|
||||
|
||||
type Review @table(name: "Reviews", key: ["movie", "user"]) {
|
||||
user: User!
|
||||
movie: Movie!
|
||||
rating: Int
|
||||
reviewText: String
|
||||
reviewDate: Date! @default(expr: "request.time")
|
||||
}
|
||||
12
dataconnect/seed_data.gql
Normal file
12
dataconnect/seed_data.gql
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
mutation @transaction {
|
||||
movie_insertMany(
|
||||
data: [
|
||||
{
|
||||
id: "550e8400-e29b-41d4-a716-446655440000",
|
||||
title: "Quantum Paradox",
|
||||
imageUrl: "https://firebasestorage.googleapis.com/v0/b/fdc-web-quickstart.appspot.com/o/movie%2Fquantum_paradox.jpeg?alt=media&token=4142e2a1-bf43-43b5-b7cf-6616be3fd4e3",
|
||||
genre: "sci-fi"
|
||||
}
|
||||
]
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue