-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: add GQloom example: GraphQL + Zod + Prisma #8331
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
Open
xcfox
wants to merge
19
commits into
prisma:latest
Choose a base branch
from
xcfox:gqloom
base: latest
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6bfa271
feat: initialize GraphQL ORM with Prisma and GQloom
xcfox d5398cd
refactor: rename allUsers query to users in GraphQL schema and resolver
xcfox 58204de
fix: update email validation in signupUser mutation to use z.email()
xcfox 1e6620a
feat: migrate database from SQLite to PostgreSQL and enhance query ca…
xcfox 4461882
feat: add README for GraphQL server example with TypeScript, Prisma, …
xcfox 4c99abe
chore: remove generated Prisma files for User and Post models along w…
xcfox 370ee85
chore: add .gitignore file to exclude node_modules, dist, environment…
xcfox e555077
feat: add test setup script for GraphQL GQloom integration with Prisma
xcfox ad6cabc
docs: update GQLoom description in README to clarify its Code-First a…
xcfox 91249ed
feat: update TypeScript configuration and enhance resolvers with sele…
xcfox 527b193
fix: change post and user ID types from Float to Int in GraphQL schem…
xcfox b7c28f5
Update .github/tests/orm/graphql-gqloom/run.sh
xcfox 6511211
Update orm/graphql-gqloom/src/resolvers/post.ts
xcfox 2e2a5a5
Update orm/graphql-gqloom/src/server.ts
xcfox 9d3eda5
Update orm/graphql-gqloom/src/resolvers/user.ts
xcfox 6ff4846
Update orm/graphql-gqloom/src/db.ts
xcfox 60c96ef
Update .github/tests/orm/graphql-gqloom/run.sh
xcfox f7fc824
Update orm/graphql-gqloom/src/resolvers/post.ts
xcfox 8e2afa1
Refactor seed.ts to use centralized Prisma client instance
xcfox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -eu | ||
|
|
||
| echo "🔍 Starting test setup for graphql-gqloom..." | ||
|
|
||
| echo "📂 Current working directory before REPO_ROOT: $(pwd)" | ||
| echo "📁 Listing contents:" | ||
| ls -la | ||
|
|
||
| REPO_ROOT="$(git rev-parse --show-toplevel)" | ||
| echo "📌 Detected repo root: $REPO_ROOT" | ||
|
|
||
| cd "$REPO_ROOT/orm/graphql-gqloom" | ||
| echo "📂 Changed directory to: $(pwd)" | ||
|
|
||
| echo "📦 Installing test deps..." | ||
| npm install | ||
|
|
||
| # Go to Node script dir and install its deps | ||
| NODE_SCRIPT_DIR="../../.github/get-ppg-dev" | ||
| pushd "$NODE_SCRIPT_DIR" > /dev/null | ||
| npm install | ||
|
|
||
| # Start Prisma Dev server | ||
| LOG_FILE="./ppg-dev-url.log" | ||
| rm -f "$LOG_FILE" | ||
| touch "$LOG_FILE" | ||
|
|
||
| echo "🚀 Starting Prisma Dev in background..." | ||
| node index.js >"$LOG_FILE" & | ||
| NODE_PID=$! | ||
|
|
||
| # Wait for DATABASE_URL | ||
| echo "🔎 Waiting for Prisma Dev to emit DATABASE_URL..." | ||
| MAX_WAIT=60 | ||
| WAITED=0 | ||
| until grep -q '^prisma+postgres://' "$LOG_FILE"; do | ||
| sleep 1 | ||
| WAITED=$((WAITED + 1)) | ||
| if [ "$WAITED" -ge "$MAX_WAIT" ]; then | ||
| echo "❌ Timeout waiting for DATABASE_URL" | ||
| cat "$LOG_FILE" | ||
| kill "$NODE_PID" || true | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| DB_URL=$(grep '^prisma+postgres://' "$LOG_FILE" | tail -1) | ||
| export DATABASE_URL="$DB_URL" | ||
| echo "✅ DATABASE_URL: $DATABASE_URL" | ||
|
|
||
| popd > /dev/null # Back to orm/graphql-gqloom | ||
|
|
||
| # Run migrations and seed | ||
| npx prisma migrate reset --force --skip-seed | ||
| npx prisma migrate dev --name init | ||
| npx prisma db seed | ||
|
|
||
| # Start the app | ||
| npm run dev & | ||
| pid=$! | ||
|
|
||
| # Wait for app to be ready | ||
| echo "🔎 Waiting for app to be ready..." | ||
| MAX_WAIT=60 | ||
| WAITED=0 | ||
| until curl -s http://localhost:4000/ > /dev/null 2>&1; do | ||
| sleep 1 | ||
| WAITED=$((WAITED + 1)) | ||
| if [ "$WAITED" -ge "$MAX_WAIT" ]; then | ||
| echo "❌ Timeout waiting for app to start" | ||
| kill "$pid" 2>/dev/null || true | ||
| kill "$NODE_PID" 2>/dev/null || true | ||
| exit 1 | ||
| fi | ||
| done | ||
| echo "✅ App is ready" | ||
|
|
||
| # Run GraphQL Postman collection | ||
| echo "🧪 Running Postman tests..." | ||
| npx newman run "$REPO_ROOT/.github/tests/postman_collections/graphql.json" --bail | ||
|
|
||
| # Cleanup | ||
| echo "🛑 Shutting down app (PID $pid) and Prisma Dev (PID $NODE_PID)..." | ||
| kill "$pid" 2>/dev/null || true | ||
| kill "$NODE_PID" | ||
| wait "$NODE_PID" 2>/dev/null || true | ||
| wait "$pid" 2>/dev/null || true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| node_modules/ | ||
| dist/ | ||
| *.env* | ||
| src/generated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| lts/jod |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.