mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-03-01 12:44:28 +00:00
Compare commits
No commits in common. "master" and "b3.14.1-36" have entirely different histories.
master
...
b3.14.1-36
8
.github/workflows/check-documentation.yml
vendored
8
.github/workflows/check-documentation.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
|||||||
documentation: ${{ steps.changes.outputs.documentation }}
|
documentation: ${{ steps.changes.outputs.documentation }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Check for markdown file changes
|
- name: Check for markdown file changes
|
||||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
@ -28,7 +28,7 @@ jobs:
|
|||||||
if: needs.files-changed.outputs.markdown == 'true'
|
if: needs.files-changed.outputs.markdown == 'true'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Remove uncheckable documentation files
|
- name: Remove uncheckable documentation files
|
||||||
run: rm -rf ./CHANGELOG.md # workaround until https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/183 has been done
|
run: rm -rf ./CHANGELOG.md # workaround until https://github.com/gaurav-nelson/github-action-markdown-link-check/pull/183 has been done
|
||||||
@ -51,10 +51,10 @@ jobs:
|
|||||||
if: needs.files-changed.outputs.documentation == 'true'
|
if: needs.files-changed.outputs.documentation == 'true'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Setup Node 20
|
- name: Setup Node 20
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
|
|
||||||
|
|||||||
6
.github/workflows/deploy-documentation.yml
vendored
6
.github/workflows/deploy-documentation.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
|||||||
documentation: ${{ steps.changes.outputs.documentation }}
|
documentation: ${{ steps.changes.outputs.documentation }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Check for file changes
|
- name: Check for file changes
|
||||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
@ -27,10 +27,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Setup Node 20
|
- name: Setup Node 20
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
|
|
||||||
|
|||||||
8
.github/workflows/docker-push.yml
vendored
8
.github/workflows/docker-push.yml
vendored
@ -59,9 +59,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9
|
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9
|
||||||
with:
|
with:
|
||||||
@ -83,7 +81,7 @@ jobs:
|
|||||||
type=sha
|
type=sha
|
||||||
- name: Build and push Docker images
|
- name: Build and push Docker images
|
||||||
id: push
|
id: push
|
||||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
|
||||||
with:
|
with:
|
||||||
context: ${{ matrix.app.context }}
|
context: ${{ matrix.app.context }}
|
||||||
target: ${{ matrix.app.target }}
|
target: ${{ matrix.app.target }}
|
||||||
@ -91,5 +89,3 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=gha,scope=${{ matrix.app.name }}
|
|
||||||
cache-to: type=gha,mode=max,scope=${{ matrix.app.name }}
|
|
||||||
|
|||||||
8
.github/workflows/publish.yml
vendored
8
.github/workflows/publish.yml
vendored
@ -14,11 +14,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Fetch full History for changelog
|
fetch-depth: 0 # Fetch full History for changelog
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
- name: Setup env
|
- name: Setup env
|
||||||
@ -58,11 +58,11 @@ jobs:
|
|||||||
needs: [github_tag]
|
needs: [github_tag]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Fetch full History for changelog
|
fetch-depth: 0 # Fetch full History for changelog
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
- name: Setup env
|
- name: Setup env
|
||||||
|
|||||||
52
.github/workflows/test-backend.yml
vendored
52
.github/workflows/test-backend.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
|||||||
backend: ${{ steps.changes.outputs.backend }}
|
backend: ${{ steps.changes.outputs.backend }}
|
||||||
docker: ${{ steps.changes.outputs.docker }}
|
docker: ${{ steps.changes.outputs.docker }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Check for backend file changes
|
- name: Check for backend file changes
|
||||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
@ -28,24 +28,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
|
||||||
|
|
||||||
- name: Neo4J | Build 'community' image
|
- name: Neo4J | Build 'community' image
|
||||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
run: |
|
||||||
with:
|
docker compose -f docker-compose.yml -f docker-compose.test.yml build neo4j
|
||||||
context: neo4j
|
docker save "ghcr.io/ocelot-social-community/ocelot-social/neo4j:community" > /tmp/neo4j.tar
|
||||||
file: neo4j/Dockerfile
|
|
||||||
target: community
|
|
||||||
load: true
|
|
||||||
tags: ghcr.io/ocelot-social-community/ocelot-social/neo4j:community
|
|
||||||
cache-from: type=gha,scope=neo4j
|
|
||||||
cache-to: type=gha,mode=max,scope=neo4j
|
|
||||||
|
|
||||||
- name: Save image for test job
|
|
||||||
run: docker save "ghcr.io/ocelot-social-community/ocelot-social/neo4j:community" > /tmp/neo4j.tar
|
|
||||||
|
|
||||||
- name: Cache docker images
|
- name: Cache docker images
|
||||||
id: cache-neo4j
|
id: cache-neo4j
|
||||||
@ -61,24 +49,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
|
||||||
|
|
||||||
- name: backend | Build 'test' image
|
- name: backend | Build 'test' image
|
||||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
run: |
|
||||||
with:
|
docker compose -f docker-compose.yml -f docker-compose.test.yml build backend
|
||||||
context: backend
|
docker save "ghcr.io/ocelot-social-community/ocelot-social/backend:test" > /tmp/backend.tar
|
||||||
file: backend/Dockerfile
|
|
||||||
target: test
|
|
||||||
load: true
|
|
||||||
tags: ghcr.io/ocelot-social-community/ocelot-social/backend:test
|
|
||||||
cache-from: type=gha,scope=backend-test
|
|
||||||
cache-to: type=gha,mode=max,scope=backend-test
|
|
||||||
|
|
||||||
- name: Save image for test job
|
|
||||||
run: docker save "ghcr.io/ocelot-social-community/ocelot-social/backend:test" > /tmp/backend.tar
|
|
||||||
|
|
||||||
- name: Cache docker images
|
- name: Cache docker images
|
||||||
id: cache-backend
|
id: cache-backend
|
||||||
@ -94,17 +70,15 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
||||||
with:
|
with:
|
||||||
node-version-file: 'backend/.nvmrc'
|
node-version-file: 'backend/.nvmrc'
|
||||||
cache: 'yarn'
|
|
||||||
cache-dependency-path: 'backend/yarn.lock'
|
|
||||||
|
|
||||||
- name: backend | Lint
|
- name: backend | Lint
|
||||||
run: cd backend && yarn --frozen-lockfile && yarn run lint
|
run: cd backend && yarn && yarn run lint
|
||||||
|
|
||||||
unit_test_backend:
|
unit_test_backend:
|
||||||
name: Unit tests - Backend
|
name: Unit tests - Backend
|
||||||
@ -115,7 +89,7 @@ jobs:
|
|||||||
checks: write
|
checks: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Restore Neo4J cache
|
- name: Restore Neo4J cache
|
||||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
||||||
|
|||||||
103
.github/workflows/test-e2e.yml
vendored
103
.github/workflows/test-e2e.yml
vendored
@ -8,52 +8,28 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
|
||||||
|
|
||||||
- name: Copy backend env file
|
- name: Copy backend env file
|
||||||
run: |
|
run: |
|
||||||
cp backend/.env.test_e2e backend/.env
|
cp backend/.env.test_e2e backend/.env
|
||||||
cp webapp/.env.template webapp/.env
|
cp webapp/.env.template webapp/.env
|
||||||
|
|
||||||
- name: Neo4J | Build image
|
- name: Build backend and dependencies
|
||||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
|
||||||
with:
|
|
||||||
context: neo4j
|
|
||||||
file: neo4j/Dockerfile
|
|
||||||
target: community
|
|
||||||
load: true
|
|
||||||
tags: ghcr.io/ocelot-social-community/ocelot-social/neo4j:community
|
|
||||||
cache-from: type=gha,scope=neo4j
|
|
||||||
cache-to: type=gha,mode=max,scope=neo4j
|
|
||||||
|
|
||||||
- name: Backend | Build image
|
|
||||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
|
||||||
with:
|
|
||||||
context: backend
|
|
||||||
file: backend/Dockerfile
|
|
||||||
target: test
|
|
||||||
load: true
|
|
||||||
tags: ghcr.io/ocelot-social-community/ocelot-social/backend:test
|
|
||||||
cache-from: type=gha,scope=backend-test
|
|
||||||
cache-to: type=gha,mode=max,scope=backend-test
|
|
||||||
|
|
||||||
- name: Pull third-party images
|
|
||||||
run: |
|
run: |
|
||||||
docker pull quay.io/minio/minio:latest
|
# Build and start all required images for backend
|
||||||
docker pull quay.io/minio/mc:latest
|
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach neo4j backend --build
|
||||||
docker pull maildev/maildev:latest
|
|
||||||
|
|
||||||
- name: Save all images
|
# Save the build images
|
||||||
run: |
|
|
||||||
docker save "ghcr.io/ocelot-social-community/ocelot-social/backend:test" > /tmp/backend.tar
|
docker save "ghcr.io/ocelot-social-community/ocelot-social/backend:test" > /tmp/backend.tar
|
||||||
docker save "ghcr.io/ocelot-social-community/ocelot-social/neo4j:community" > /tmp/neo4j.tar
|
docker save "ghcr.io/ocelot-social-community/ocelot-social/neo4j:community" > /tmp/neo4j.tar
|
||||||
docker save "quay.io/minio/minio:latest" > /tmp/minio.tar
|
docker save "quay.io/minio/minio:latest" > /tmp/minio.tar
|
||||||
docker save "quay.io/minio/mc:latest" > /tmp/minio-mc.tar
|
docker save "quay.io/minio/mc:latest" > /tmp/minio-mc.tar
|
||||||
docker save "maildev/maildev:latest" > /tmp/mailserver.tar
|
docker save "maildev/maildev:latest" > /tmp/mailserver.tar
|
||||||
|
|
||||||
|
# Stop the containers
|
||||||
|
docker compose -f docker-compose.yml -f docker-compose.test.yml down
|
||||||
|
|
||||||
- name: Cache docker images
|
- name: Cache docker images
|
||||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
||||||
with:
|
with:
|
||||||
@ -70,24 +46,17 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Copy backend env file
|
||||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
run: |
|
||||||
|
cp backend/.env.test_e2e backend/.env
|
||||||
|
cp webapp/.env.template webapp/.env
|
||||||
|
|
||||||
- name: Webapp | Build 'test' image
|
- name: Build docker image
|
||||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
run: |
|
||||||
with:
|
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach webapp --build --no-deps
|
||||||
context: .
|
docker save "ghcr.io/ocelot-social-community/ocelot-social/webapp:test" > /tmp/webapp.tar
|
||||||
file: webapp/Dockerfile
|
|
||||||
target: test
|
|
||||||
load: true
|
|
||||||
tags: ghcr.io/ocelot-social-community/ocelot-social/webapp:test
|
|
||||||
cache-from: type=gha,scope=webapp-test
|
|
||||||
cache-to: type=gha,mode=max,scope=webapp-test
|
|
||||||
|
|
||||||
- name: Save image for test jobs
|
|
||||||
run: docker save "ghcr.io/ocelot-social-community/ocelot-social/webapp:test" > /tmp/webapp.tar
|
|
||||||
|
|
||||||
- name: Cache docker image
|
- name: Cache docker image
|
||||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
||||||
@ -103,10 +72,10 @@ jobs:
|
|||||||
run: rm -rf /opt/hostedtoolcache
|
run: rm -rf /opt/hostedtoolcache
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: 'backend/.nvmrc'
|
node-version-file: 'backend/.nvmrc'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
@ -118,8 +87,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install cypress requirements
|
- name: Install cypress requirements
|
||||||
run: |
|
run: |
|
||||||
sudo wget --no-verbose -O /opt/cucumber-json-formatter "https://github.com/cucumber/json-formatter/releases/download/v19.0.0/cucumber-json-formatter-linux-amd64"
|
sudo wget --no-verbose -O /opt/cucumber-json-formatter "https://github.com/cucumber/json-formatter/releases/download/v19.0.0/cucumber-json-formatter-linux-386"
|
||||||
echo "66a2ef158866c3ecb3d8e49a7189814a485bddca43e133e4ca5735b8d3951bf7 /opt/cucumber-json-formatter" | sha256sum -c -
|
|
||||||
sudo chmod +x /opt/cucumber-json-formatter
|
sudo chmod +x /opt/cucumber-json-formatter
|
||||||
cd backend
|
cd backend
|
||||||
yarn install
|
yarn install
|
||||||
@ -144,7 +112,7 @@ jobs:
|
|||||||
features: ${{ steps.list.outputs.features }}
|
features: ${{ steps.list.outputs.features }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
|
||||||
|
|
||||||
- name: List feature files
|
- name: List feature files
|
||||||
id: list
|
id: list
|
||||||
@ -166,10 +134,10 @@ jobs:
|
|||||||
run: rm -rf /opt/hostedtoolcache
|
run: rm -rf /opt/hostedtoolcache
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.4.0
|
||||||
with:
|
with:
|
||||||
node-version-file: 'backend/.nvmrc'
|
node-version-file: 'backend/.nvmrc'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
@ -201,22 +169,10 @@ jobs:
|
|||||||
path: /tmp/webapp.tar
|
path: /tmp/webapp.tar
|
||||||
key: ${{ github.run_id }}-e2e-webapp-cache
|
key: ${{ github.run_id }}-e2e-webapp-cache
|
||||||
|
|
||||||
- name: Copy env files
|
|
||||||
run: |
|
|
||||||
cp webapp/.env.template webapp/.env
|
|
||||||
cp backend/.env.test_e2e backend/.env
|
|
||||||
|
|
||||||
- name: Ensure cucumber-json-formatter exists
|
|
||||||
run: |
|
|
||||||
if [ ! -f /opt/cucumber-json-formatter ]; then
|
|
||||||
sudo wget --no-verbose -O /opt/cucumber-json-formatter "https://github.com/cucumber/json-formatter/releases/download/v19.0.0/cucumber-json-formatter-linux-amd64"
|
|
||||||
echo "66a2ef158866c3ecb3d8e49a7189814a485bddca43e133e4ca5735b8d3951bf7 /opt/cucumber-json-formatter" | sha256sum -c -
|
|
||||||
fi
|
|
||||||
sudo chmod +x /opt/cucumber-json-formatter
|
|
||||||
sudo ln -fs /opt/cucumber-json-formatter /usr/bin/cucumber-json-formatter
|
|
||||||
|
|
||||||
- name: Boot up test system | docker compose
|
- name: Boot up test system | docker compose
|
||||||
run: |
|
run: |
|
||||||
|
chmod +x /opt/cucumber-json-formatter
|
||||||
|
sudo ln -fs /opt/cucumber-json-formatter /usr/bin/cucumber-json-formatter
|
||||||
docker load < /tmp/neo4j.tar
|
docker load < /tmp/neo4j.tar
|
||||||
docker load < /tmp/backend.tar
|
docker load < /tmp/backend.tar
|
||||||
docker load < /tmp/minio.tar
|
docker load < /tmp/minio.tar
|
||||||
@ -224,14 +180,7 @@ jobs:
|
|||||||
docker load < /tmp/mailserver.tar
|
docker load < /tmp/mailserver.tar
|
||||||
docker load < /tmp/webapp.tar
|
docker load < /tmp/webapp.tar
|
||||||
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach backend mailserver webapp
|
docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach backend mailserver webapp
|
||||||
|
sleep 90s
|
||||||
echo "Waiting for backend (max 120s)..."
|
|
||||||
timeout 120 bash -c 'until curl -sf -X POST -H "Content-Type: application/json" -d "{\"query\":\"{__typename}\"}" http://localhost:4000 > /dev/null 2>&1; do sleep 5; done'
|
|
||||||
echo "Backend is ready."
|
|
||||||
|
|
||||||
echo "Waiting for webapp (max 120s)..."
|
|
||||||
timeout 120 bash -c 'until curl -sf http://localhost:3000 > /dev/null 2>&1; do sleep 5; done'
|
|
||||||
echo "Webapp is ready."
|
|
||||||
|
|
||||||
- name: Full stack tests | run tests
|
- name: Full stack tests | run tests
|
||||||
id: e2e-tests
|
id: e2e-tests
|
||||||
|
|||||||
38
.github/workflows/test-webapp.yml
vendored
38
.github/workflows/test-webapp.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
|||||||
docker: ${{ steps.changes.outputs.docker }}
|
docker: ${{ steps.changes.outputs.docker }}
|
||||||
webapp: ${{ steps.changes.outputs.webapp }}
|
webapp: ${{ steps.changes.outputs.webapp }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Check for frontend file changes
|
- name: Check for frontend file changes
|
||||||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||||
@ -28,10 +28,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
||||||
with:
|
with:
|
||||||
node-version-file: 'webapp/.nvmrc'
|
node-version-file: 'webapp/.nvmrc'
|
||||||
|
|
||||||
@ -43,28 +43,16 @@ jobs:
|
|||||||
build_test_webapp:
|
build_test_webapp:
|
||||||
name: Docker Build Test - Webapp
|
name: Docker Build Test - Webapp
|
||||||
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
||||||
needs: files-changed
|
needs: [files-changed, prepare]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
|
||||||
|
|
||||||
- name: Webapp | Build 'test' image
|
- name: Webapp | Build 'test' image
|
||||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
run: |
|
||||||
with:
|
docker build --target test -f webapp/Dockerfile -t "ghcr.io/ocelot-social-community/ocelot-social/webapp:test" .
|
||||||
context: .
|
docker save "ghcr.io/ocelot-social-community/ocelot-social/webapp:test" > /tmp/webapp.tar
|
||||||
file: webapp/Dockerfile
|
|
||||||
target: test
|
|
||||||
load: true
|
|
||||||
tags: ghcr.io/ocelot-social-community/ocelot-social/webapp:test
|
|
||||||
cache-from: type=gha,scope=webapp-test
|
|
||||||
cache-to: type=gha,mode=max,scope=webapp-test
|
|
||||||
|
|
||||||
- name: Save image for test job
|
|
||||||
run: docker save "ghcr.io/ocelot-social-community/ocelot-social/webapp:test" > /tmp/webapp.tar
|
|
||||||
|
|
||||||
- name: Cache docker image
|
- name: Cache docker image
|
||||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
||||||
@ -79,17 +67,15 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4.0.3
|
||||||
with:
|
with:
|
||||||
node-version-file: 'webapp/.nvmrc'
|
node-version-file: 'webapp/.nvmrc'
|
||||||
cache: 'yarn'
|
|
||||||
cache-dependency-path: 'webapp/yarn.lock'
|
|
||||||
|
|
||||||
- name: webapp | Lint
|
- name: webapp | Lint
|
||||||
run: cd webapp && yarn --frozen-lockfile && yarn run lint
|
run: cd webapp && yarn && yarn run lint
|
||||||
|
|
||||||
unit_test_webapp:
|
unit_test_webapp:
|
||||||
name: Unit Tests - Webapp
|
name: Unit Tests - Webapp
|
||||||
@ -100,7 +86,7 @@ jobs:
|
|||||||
checks: write
|
checks: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7
|
||||||
|
|
||||||
- name: Restore webapp cache
|
- name: Restore webapp cache
|
||||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4.0.2
|
||||||
|
|||||||
14
.github/workflows/ui-docker.yml
vendored
14
.github/workflows/ui-docker.yml
vendored
@ -34,26 +34,26 @@ jobs:
|
|||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Build development image
|
- name: Build development image
|
||||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./packages/ui
|
context: ./packages/ui
|
||||||
file: ./packages/ui/Dockerfile
|
file: ./packages/ui/Dockerfile
|
||||||
target: development
|
target: development
|
||||||
push: false
|
push: false
|
||||||
tags: ocelot-social/ui:development
|
tags: ocelot-social/ui:development
|
||||||
cache-from: type=gha,scope=ui-development
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max,scope=ui-development
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
- name: Build production image
|
- name: Build production image
|
||||||
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./packages/ui
|
context: ./packages/ui
|
||||||
file: ./packages/ui/Dockerfile
|
file: ./packages/ui/Dockerfile
|
||||||
target: production
|
target: production
|
||||||
push: false
|
push: false
|
||||||
tags: ocelot-social/ui:latest
|
tags: ocelot-social/ui:latest
|
||||||
cache-from: type=gha,scope=ui-production
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max,scope=ui-production
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
3
backend/.eslintignore
Normal file
3
backend/.eslintignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
node_modules/
|
||||||
|
build/
|
||||||
|
coverage/
|
||||||
263
backend/.eslintrc.cjs
Normal file
263
backend/.eslintrc.cjs
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
// eslint-disable-next-line import/no-commonjs
|
||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
env: {
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
plugins: ['prettier', '@typescript-eslint', 'import', 'n', 'promise', 'security', 'no-catch-all'],
|
||||||
|
extends: [
|
||||||
|
'standard',
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:n/recommended',
|
||||||
|
'plugin:prettier/recommended',
|
||||||
|
'plugin:import/recommended',
|
||||||
|
'plugin:import/typescript',
|
||||||
|
'plugin:promise/recommended',
|
||||||
|
'plugin:@eslint-community/eslint-comments/recommended',
|
||||||
|
'prettier',
|
||||||
|
],
|
||||||
|
settings: {
|
||||||
|
'import/parsers': {
|
||||||
|
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
||||||
|
},
|
||||||
|
'import/resolver': {
|
||||||
|
typescript: {
|
||||||
|
project: ['./tsconfig.json', './backend/tsconfig.json'],
|
||||||
|
},
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'no-catch-all/no-catch-all': 'error',
|
||||||
|
'no-console': 'error',
|
||||||
|
camelcase: 'error',
|
||||||
|
'no-debugger': 'error',
|
||||||
|
'prettier/prettier': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
htmlWhitespaceSensitivity: 'ignore',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// import
|
||||||
|
'import/export': 'error',
|
||||||
|
// 'import/no-deprecated': 'error',
|
||||||
|
'import/no-empty-named-blocks': 'error',
|
||||||
|
'import/no-extraneous-dependencies': 'error',
|
||||||
|
'import/no-mutable-exports': 'error',
|
||||||
|
'import/no-unused-modules': 'error',
|
||||||
|
'import/no-named-as-default': 'error',
|
||||||
|
'import/no-named-as-default-member': 'error',
|
||||||
|
'import/no-amd': 'error',
|
||||||
|
'import/no-commonjs': 'error',
|
||||||
|
'import/no-import-module-exports': 'error',
|
||||||
|
'import/no-nodejs-modules': 'off',
|
||||||
|
'import/unambiguous': 'off', // not compatible with .eslintrc.cjs
|
||||||
|
'import/default': 'error',
|
||||||
|
'import/named': 'off', // has false positives
|
||||||
|
'import/namespace': 'error',
|
||||||
|
'import/no-absolute-path': 'error',
|
||||||
|
'import/no-cycle': 'error',
|
||||||
|
'import/no-dynamic-require': 'error',
|
||||||
|
'import/no-internal-modules': 'off',
|
||||||
|
'import/no-relative-packages': 'error',
|
||||||
|
'import/no-relative-parent-imports': ['error', { ignore: ['@/*'] }],
|
||||||
|
'import/no-self-import': 'error',
|
||||||
|
'import/no-unresolved': 'error',
|
||||||
|
'import/no-useless-path-segments': 'error',
|
||||||
|
'import/no-webpack-loader-syntax': 'error',
|
||||||
|
'import/consistent-type-specifier-style': 'error',
|
||||||
|
'import/exports-last': 'off',
|
||||||
|
'import/extensions': 'error',
|
||||||
|
'import/first': 'error',
|
||||||
|
'import/group-exports': 'off',
|
||||||
|
'import/newline-after-import': 'error',
|
||||||
|
'import/no-anonymous-default-export': 'off', // not compatible with neode
|
||||||
|
'import/no-default-export': 'off', // not compatible with neode
|
||||||
|
'import/no-duplicates': 'error',
|
||||||
|
'import/no-named-default': 'error',
|
||||||
|
'import/no-namespace': 'error',
|
||||||
|
'import/no-unassigned-import': 'error',
|
||||||
|
'import/order': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
|
||||||
|
'newlines-between': 'always',
|
||||||
|
pathGroups: [
|
||||||
|
{
|
||||||
|
pattern: '@?*/**',
|
||||||
|
group: 'external',
|
||||||
|
position: 'after',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pattern: '@/**',
|
||||||
|
group: 'external',
|
||||||
|
position: 'after',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
alphabetize: {
|
||||||
|
order: 'asc' /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */,
|
||||||
|
caseInsensitive: true /* ignore case. Options: [true, false] */,
|
||||||
|
},
|
||||||
|
distinctGroup: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'import/prefer-default-export': 'off',
|
||||||
|
|
||||||
|
// n
|
||||||
|
// 'n/callback-return': 'error',
|
||||||
|
'n/exports-style': 'error',
|
||||||
|
'n/file-extension-in-import': ['error', 'never'],
|
||||||
|
'n/global-require': 'error',
|
||||||
|
'n/handle-callback-err': 'error',
|
||||||
|
// 'n/hashbang': 'error', // part of n/recommended
|
||||||
|
'n/no-callback-literal': 'error',
|
||||||
|
// 'n/no-deprecated-api': 'error', // part of n/recommended
|
||||||
|
// 'n/no-exports-assign': 'error', // part of n/recommended
|
||||||
|
'n/no-extraneous-import': 'off', // duplicate of import/no-extraneous-dependencies // part of n/recommended
|
||||||
|
// 'n/no-extraneous-require': 'error', // part of n/recommended
|
||||||
|
'n/no-hide-core-modules': 'error',
|
||||||
|
'n/no-missing-import': 'off', // not compatible with typescript // part of n/recommended
|
||||||
|
// 'n/no-missing-require': 'error', // part of n/recommended
|
||||||
|
'n/no-mixed-requires': 'error',
|
||||||
|
'n/no-new-require': 'error',
|
||||||
|
'n/no-path-concat': 'error',
|
||||||
|
'n/no-process-env': 'error',
|
||||||
|
// 'n/no-process-exit': 'error', // part of n/recommended
|
||||||
|
'n/no-restricted-import': 'error',
|
||||||
|
'n/no-restricted-require': 'error',
|
||||||
|
'n/no-sync': 'error',
|
||||||
|
// 'n/no-unpublished-bin': 'error', // part of n/recommended
|
||||||
|
'n/no-unpublished-import': [
|
||||||
|
'error',
|
||||||
|
{ allowModules: ['apollo-server-testing', 'rosie', '@faker-js/faker', 'ts-jest'] },
|
||||||
|
], // part of n/recommended
|
||||||
|
'n/no-unpublished-require': ['error', { allowModules: ['ts-jest', 'require-json5'] }], // part of n/recommended
|
||||||
|
// 'n/no-unsupported-features/es-builtins': 'error', // part of n/recommended
|
||||||
|
// 'n/no-unsupported-features/es-syntax': 'error', // part of n/recommended
|
||||||
|
// 'n/no-unsupported-features/node-builtins': 'error', // part of n/recommended
|
||||||
|
'n/prefer-global/buffer': 'error',
|
||||||
|
'n/prefer-global/console': 'error',
|
||||||
|
'n/prefer-global/process': 'error',
|
||||||
|
'n/prefer-global/text-decoder': 'error',
|
||||||
|
'n/prefer-global/text-encoder': 'error',
|
||||||
|
'n/prefer-global/url': 'error',
|
||||||
|
'n/prefer-global/url-search-params': 'error',
|
||||||
|
'n/prefer-node-protocol': 'error',
|
||||||
|
'n/prefer-promises/dns': 'error',
|
||||||
|
'n/prefer-promises/fs': 'error',
|
||||||
|
// 'n/process-exit-as-throw': 'error', // part of n/recommended
|
||||||
|
'n/shebang': 'error',
|
||||||
|
|
||||||
|
// promise
|
||||||
|
// 'promise/always-return': 'error', // part of promise/recommended
|
||||||
|
'promise/avoid-new': 'error',
|
||||||
|
// 'promise/catch-or-return': 'error', // part of promise/recommended
|
||||||
|
// 'promise/no-callback-in-promise': 'warn', // part of promise/recommended
|
||||||
|
'promise/no-multiple-resolved': 'error',
|
||||||
|
'promise/no-native': 'off', // ES5 only
|
||||||
|
// 'promise/no-nesting': 'warn', // part of promise/recommended
|
||||||
|
// 'promise/no-new-statics': 'error', // part of promise/recommended
|
||||||
|
// 'promise/no-promise-in-callback': 'warn', // part of promise/recommended
|
||||||
|
// 'promise/no-return-in-finally': 'warn', // part of promise/recommended
|
||||||
|
// 'promise/no-return-wrap': 'error', // part of promise/recommended
|
||||||
|
// 'promise/param-names': 'error', // part of promise/recommended
|
||||||
|
'promise/prefer-await-to-callbacks': 'error',
|
||||||
|
'promise/prefer-catch': 'error',
|
||||||
|
'promise/spec-only': 'error',
|
||||||
|
// 'promise/valid-params': 'error', // part of promise/recommended
|
||||||
|
|
||||||
|
// eslint comments
|
||||||
|
'@eslint-community/eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
|
||||||
|
'@eslint-community/eslint-comments/no-restricted-disable': 'error',
|
||||||
|
'@eslint-community/eslint-comments/no-use': 'off',
|
||||||
|
'@eslint-community/eslint-comments/require-description': 'off',
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['*.js', '*.cjs', '*.ts', '*.tsx'],
|
||||||
|
extends: ['plugin:security/recommended-legacy'],
|
||||||
|
},
|
||||||
|
// only for ts files
|
||||||
|
{
|
||||||
|
files: ['*.ts', '*.tsx'],
|
||||||
|
extends: [
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||||
|
'plugin:@typescript-eslint/strict',
|
||||||
|
'prettier',
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
// allow explicitly defined dangling promises
|
||||||
|
// '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
|
||||||
|
'no-void': ['error', { allowAsStatement: true }],
|
||||||
|
// ignore prefer-regexp-exec rule to allow string.match(regex)
|
||||||
|
'@typescript-eslint/prefer-regexp-exec': 'off',
|
||||||
|
// this should not run on ts files: https://github.com/import-js/eslint-plugin-import/issues/2215#issuecomment-911245486
|
||||||
|
'import/unambiguous': 'off',
|
||||||
|
// this is not compatible with typeorm, due to joined tables can be null, but are not defined as nullable
|
||||||
|
'@typescript-eslint/no-unnecessary-condition': 'off',
|
||||||
|
// respect underscore as acceptable unused variable
|
||||||
|
'@typescript-eslint/no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
tsconfigRootDir: __dirname,
|
||||||
|
project: ['./tsconfig.json'],
|
||||||
|
// this is to properly reference the referenced project database without requirement of compiling it
|
||||||
|
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['*.spec.ts'],
|
||||||
|
plugins: ['jest'],
|
||||||
|
env: {
|
||||||
|
jest: true,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'jest/no-disabled-tests': 'error',
|
||||||
|
'jest/no-focused-tests': 'error',
|
||||||
|
'jest/no-identical-title': 'error',
|
||||||
|
'jest/prefer-to-have-length': 'error',
|
||||||
|
'jest/valid-expect': 'error',
|
||||||
|
'@typescript-eslint/unbound-method': 'off',
|
||||||
|
'jest/unbound-method': 'error',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extends: ['plugin:jsonc/recommended-with-jsonc'],
|
||||||
|
files: ['*.json', '*.json5', '*.jsonc'],
|
||||||
|
parser: 'jsonc-eslint-parser',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['*.graphql', '*.gql'],
|
||||||
|
parser: '@graphql-eslint/eslint-plugin',
|
||||||
|
plugins: ['@graphql-eslint'],
|
||||||
|
extends: ['plugin:@graphql-eslint/schema-recommended'],
|
||||||
|
rules: {
|
||||||
|
'@graphql-eslint/description-style': ['error', { style: 'inline' }],
|
||||||
|
'@graphql-eslint/require-description': 'off',
|
||||||
|
'@graphql-eslint/naming-convention': 'off',
|
||||||
|
'@graphql-eslint/strict-id-in-types': 'off',
|
||||||
|
'@graphql-eslint/no-typename-prefix': 'off',
|
||||||
|
// incompatible: `depends on a GraphQL validation rule "XXX" but it's not available in the "graphql" version you are using. Skipping…`
|
||||||
|
'@graphql-eslint/known-directives': 'off',
|
||||||
|
'@graphql-eslint/known-argument-names': 'off',
|
||||||
|
'@graphql-eslint/known-type-names': 'off',
|
||||||
|
'@graphql-eslint/lone-schema-definition': 'off',
|
||||||
|
'@graphql-eslint/provided-required-arguments': 'off',
|
||||||
|
'@graphql-eslint/unique-directive-names': 'off',
|
||||||
|
'@graphql-eslint/unique-directive-names-per-location': 'off',
|
||||||
|
'@graphql-eslint/unique-field-definition-names': 'off',
|
||||||
|
'@graphql-eslint/unique-operation-types': 'off',
|
||||||
|
'@graphql-eslint/unique-type-names': 'off',
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
schema: './src/graphql/types/**/*.gql',
|
||||||
|
assumeValid: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
9
backend/.prettierrc.cjs
Normal file
9
backend/.prettierrc.cjs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
module.exports = {
|
||||||
|
semi: false,
|
||||||
|
printWidth: 100,
|
||||||
|
singleQuote: true,
|
||||||
|
trailingComma: "all",
|
||||||
|
tabWidth: 2,
|
||||||
|
bracketSpacing: true
|
||||||
|
};
|
||||||
@ -1,89 +0,0 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
||||||
import config from 'eslint-config-it4c'
|
|
||||||
import graphql from 'eslint-config-it4c/modules/graphql'
|
|
||||||
import jest from 'eslint-config-it4c/modules/jest'
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
ignores: ['node_modules/', 'build/', 'coverage/'],
|
|
||||||
},
|
|
||||||
...config,
|
|
||||||
...jest,
|
|
||||||
// GraphQL schema linting (extend file pattern to include .gql)
|
|
||||||
...graphql.map((c) => ({
|
|
||||||
...c,
|
|
||||||
files: ['**/*.graphql', '**/*.gql'],
|
|
||||||
})),
|
|
||||||
{
|
|
||||||
files: ['**/*.graphql', '**/*.gql'],
|
|
||||||
// TODO: Parser must be set explicitly because the it4c module only provides
|
|
||||||
// plugins and rules, not languageOptions. Without this, ESLint uses the JS
|
|
||||||
// parser for .gql files. Remove when fixed in eslint-config-it4c.
|
|
||||||
languageOptions: {
|
|
||||||
parser: graphql[0].plugins['@graphql-eslint'].parser,
|
|
||||||
parserOptions: {
|
|
||||||
graphQLConfig: {
|
|
||||||
schema: './src/graphql/types/**/*.gql',
|
|
||||||
documents: './src/graphql/queries/**/*.gql',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
// Would require descriptions on every type/field/input — too noisy for now
|
|
||||||
'@graphql-eslint/require-description': 'off',
|
|
||||||
// camelCase operation names and _id/_ne underscores conflict with existing schema
|
|
||||||
'@graphql-eslint/naming-convention': 'off',
|
|
||||||
// Many types (Image, File, InviteCode, etc.) intentionally lack id: ID!
|
|
||||||
'@graphql-eslint/strict-id-in-types': 'off',
|
|
||||||
// Fields like groupType, queryLocations match parent type name by coincidence
|
|
||||||
'@graphql-eslint/no-typename-prefix': 'off',
|
|
||||||
// neo4j-graphql-js adds arguments (first, offset) at runtime not present in static schema
|
|
||||||
'@graphql-eslint/known-argument-names': 'off',
|
|
||||||
// TODO: operations-recommended rules must be disabled because the it4c
|
|
||||||
// graphql module bundles both schema and operations configs together.
|
|
||||||
// Remove when eslint-config-it4c exports them separately (e.g. graphql/schema).
|
|
||||||
'@graphql-eslint/executable-definitions': 'off',
|
|
||||||
// neo4j-graphql-js adds fields at runtime (_id, relations) not present in static schema
|
|
||||||
'@graphql-eslint/fields-on-correct-type': 'off',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// Backend-specific TypeScript overrides
|
|
||||||
files: ['**/*.ts'],
|
|
||||||
languageOptions: {
|
|
||||||
parserOptions: {
|
|
||||||
projectService: {
|
|
||||||
allowDefaultProject: ['eslint.config.ts', 'jest.config.ts', 'prettier.config.ts'],
|
|
||||||
},
|
|
||||||
tsconfigRootDir: import.meta.dirname,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
// TypeORM compatibility: joined tables can be null but are not defined as nullable
|
|
||||||
'@typescript-eslint/no-unnecessary-condition': 'off',
|
|
||||||
// Allow string.match(regex) instead of regex.exec(string)
|
|
||||||
'@typescript-eslint/prefer-regexp-exec': 'off',
|
|
||||||
// TODO: gradually add return types to exported functions, then remove this override
|
|
||||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
||||||
// Allow @/* path aliases in relative parent imports
|
|
||||||
'import-x/no-relative-parent-imports': ['error', { ignore: ['@/*'] }],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// Jest test file overrides
|
|
||||||
files: ['**/*.spec.ts'],
|
|
||||||
rules: {
|
|
||||||
'@typescript-eslint/unbound-method': 'off',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// Config files: allow require() of devDependencies
|
|
||||||
files: ['*.config.{js,mjs,cjs,ts,mts,cts}'],
|
|
||||||
rules: {
|
|
||||||
'n/no-unpublished-require': 'off',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
27
backend/jest.config.cjs
Normal file
27
backend/jest.config.cjs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/* eslint-disable import/no-commonjs */
|
||||||
|
const requireJSON5 = require('require-json5')
|
||||||
|
const { pathsToModuleNameMapper } = require('ts-jest')
|
||||||
|
|
||||||
|
const { compilerOptions } = requireJSON5('./tsconfig.json')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
verbose: true,
|
||||||
|
preset: 'ts-jest',
|
||||||
|
collectCoverage: true,
|
||||||
|
collectCoverageFrom: [
|
||||||
|
'**/*.ts',
|
||||||
|
'!**/node_modules/**',
|
||||||
|
'!**/test/**',
|
||||||
|
'!**/build/**',
|
||||||
|
'!**/src/**/?(*.)+(spec|test).ts?(x)',
|
||||||
|
'!**/src/db/**',
|
||||||
|
],
|
||||||
|
coverageThreshold: {
|
||||||
|
global: {
|
||||||
|
lines: 93,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
testMatch: ['**/src/**/?(*.)+(spec|test).ts?(x)'],
|
||||||
|
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
|
||||||
|
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),
|
||||||
|
}
|
||||||
@ -1,40 +0,0 @@
|
|||||||
import { readFileSync } from 'node:fs'
|
|
||||||
|
|
||||||
import { pathsToModuleNameMapper } from 'ts-jest'
|
|
||||||
import { parseConfigFileTextToJson } from 'typescript'
|
|
||||||
|
|
||||||
// eslint-disable-next-line n/no-sync -- config files are synchronous by nature
|
|
||||||
const tsconfigText = readFileSync('./tsconfig.json', 'utf-8')
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- parseConfigFileTextToJson returns untyped config
|
|
||||||
const { config } = parseConfigFileTextToJson('tsconfig.json', tsconfigText)
|
|
||||||
const paths = (config as { compilerOptions: { paths: Record<string, string[]> } }).compilerOptions
|
|
||||||
.paths
|
|
||||||
|
|
||||||
export default {
|
|
||||||
verbose: true,
|
|
||||||
preset: 'ts-jest',
|
|
||||||
collectCoverage: true,
|
|
||||||
collectCoverageFrom: [
|
|
||||||
'**/*.ts',
|
|
||||||
'!**/node_modules/**',
|
|
||||||
'!**/test/**',
|
|
||||||
'!**/build/**',
|
|
||||||
'!**/src/**/?(*.)+(spec|test).ts?(x)',
|
|
||||||
'!**/src/db/**',
|
|
||||||
'!*.config.ts',
|
|
||||||
'!**/*.d.ts',
|
|
||||||
'!**/gql-register.ts',
|
|
||||||
],
|
|
||||||
coverageThreshold: {
|
|
||||||
global: {
|
|
||||||
lines: 93,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
testMatch: ['**/src/**/?(*.)+(spec|test).ts?(x)'],
|
|
||||||
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
|
|
||||||
transform: {
|
|
||||||
'\\.gql$': '<rootDir>/test/graphqlTransform.ts',
|
|
||||||
'\\.tsx?$': 'ts-jest',
|
|
||||||
},
|
|
||||||
moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: '<rootDir>/' }),
|
|
||||||
}
|
|
||||||
@ -10,20 +10,20 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node build/src/",
|
"start": "node build/src/",
|
||||||
"build": "tsc && tsc-alias && ./scripts/build.copy.files.sh",
|
"build": "tsc && tsc-alias && ./scripts/build.copy.files.sh",
|
||||||
"dev": "nodemon --exec tsx src/index.ts -e js,ts,gql",
|
"dev": "nodemon --exec ts-node --require tsconfig-paths/register src/index.ts -e js,ts,gql",
|
||||||
"dev:debug": "nodemon --exec node --inspect=0.0.0.0:9229 build/src/index.js -e js,ts,gql",
|
"dev:debug": "nodemon --exec node --inspect=0.0.0.0:9229 build/src/index.js -e js,ts,gql",
|
||||||
"lint": "eslint --max-warnings 0 .",
|
"lint": "eslint --max-warnings=0 --report-unused-disable-directives --ext .js,.ts,.cjs,.json,.json5,.jsonc,.graphql,.gql .",
|
||||||
"test": "cross-env NODE_ENV=test NODE_OPTIONS=--max-old-space-size=8192 jest --runInBand --coverage --forceExit --detectOpenHandles",
|
"test": "cross-env NODE_ENV=test NODE_OPTIONS=--max-old-space-size=8192 jest --runInBand --coverage --forceExit --detectOpenHandles",
|
||||||
"db:reset": "tsx src/db/reset.ts",
|
"db:reset": "ts-node --require tsconfig-paths/register src/db/reset.ts",
|
||||||
"db:reset:withmigrations": "tsx src/db/reset-with-migrations.ts",
|
"db:reset:withmigrations": "ts-node --require tsconfig-paths/register src/db/reset-with-migrations.ts",
|
||||||
"db:seed": "tsx --require ./src/graphql/gql-register.ts src/db/seed.ts",
|
"db:seed": "ts-node --require tsconfig-paths/register src/db/seed.ts",
|
||||||
"db:data:admin": "tsx src/db/admin.ts",
|
"db:data:admin": "ts-node --require tsconfig-paths/register src/db/admin.ts",
|
||||||
"db:data:badges": "tsx src/db/badges.ts",
|
"db:data:badges": "ts-node --require tsconfig-paths/register src/db/badges.ts",
|
||||||
"db:data:branding": "tsx src/db/data-branding.ts",
|
"db:data:branding": "ts-node --require tsconfig-paths/register src/db/data-branding.ts",
|
||||||
"db:data:categories": "tsx src/db/categories.ts",
|
"db:data:categories": "ts-node --require tsconfig-paths/register src/db/categories.ts",
|
||||||
"db:migrate": "migrate --compiler 'ts:./src/db/compiler.ts' --migrations-dir ./src/db/migrations --store ./src/db/migrate/store.ts",
|
"db:migrate": "migrate --compiler 'ts:./src/db/compiler.ts' --migrations-dir ./src/db/migrations --store ./src/db/migrate/store.ts",
|
||||||
"db:migrate:create": "migrate --compiler 'ts:./src/db/compiler.ts' --migrations-dir ./src/db/migrations --template-file ./src/db/migrate/template.ts --date-format 'yyyymmddHHmmss' create",
|
"db:migrate:create": "migrate --compiler 'ts:./src/db/compiler.ts' --migrations-dir ./src/db/migrations --template-file ./src/db/migrate/template.ts --date-format 'yyyymmddHHmmss' create",
|
||||||
"db:func:disable:notifications": "tsx src/db/disable-notifications.ts",
|
"db:func:disable:notifications": "ts-node --require tsconfig-paths/register src/db/disable-notifications.ts",
|
||||||
"prod:migrate": "migrate --migrations-dir ./build/src/db/migrations --store ./build/src/db/migrate/store.js",
|
"prod:migrate": "migrate --migrations-dir ./build/src/db/migrations --store ./build/src/db/migrate/store.js",
|
||||||
"prod:db:data:branding": "node build/src/db/data-branding.js",
|
"prod:db:data:branding": "node build/src/db/data-branding.js",
|
||||||
"prod:db:data:categories": "node build/src/db/categories.js",
|
"prod:db:data:categories": "node build/src/db/categories.js",
|
||||||
@ -31,27 +31,27 @@
|
|||||||
"prod:db:func:disable:notifications": "node build/src/db/disable-notifications.js"
|
"prod:db:func:disable:notifications": "node build/src/db/disable-notifications.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/server": "^4.11.3",
|
"@aws-sdk/client-s3": "^3.990.0",
|
||||||
"@aws-sdk/client-s3": "^3.1000.0",
|
"@aws-sdk/lib-storage": "^3.990.0",
|
||||||
"@aws-sdk/lib-storage": "^3.1000.0",
|
|
||||||
"@graphql-tools/load-files": "^7.0.0",
|
|
||||||
"@graphql-tools/merge": "^9.0.0",
|
|
||||||
"@sentry/node": "^5.30.0",
|
"@sentry/node": "^5.30.0",
|
||||||
"@types/mime-types": "^3.0.1",
|
"@types/mime-types": "^3.0.1",
|
||||||
|
"apollo-server": "~2.14.2",
|
||||||
|
"apollo-server-express": "^2.14.2",
|
||||||
"bcryptjs": "~3.0.3",
|
"bcryptjs": "~3.0.3",
|
||||||
"body-parser": "^2.2.2",
|
"body-parser": "^1.20.3",
|
||||||
"cheerio": "~1.2.0",
|
"cheerio": "~1.2.0",
|
||||||
"cross-env": "~10.1.0",
|
"cross-env": "~10.1.0",
|
||||||
"dotenv": "~17.0.1",
|
"dotenv": "~17.0.1",
|
||||||
"email-templates": "^13.0.1",
|
"email-templates": "^13.0.1",
|
||||||
"express": "^4.22.1",
|
"express": "^4.22.1",
|
||||||
"graphql": "^16.13.0",
|
"graphql": "^14.6.0",
|
||||||
"graphql-middleware": "~6.1.35",
|
"graphql-middleware": "~6.1.35",
|
||||||
|
"graphql-middleware-sentry": "^3.2.1",
|
||||||
"graphql-redis-subscriptions": "^2.7.0",
|
"graphql-redis-subscriptions": "^2.7.0",
|
||||||
"graphql-shield": "^7.6.5",
|
"graphql-shield": "~7.2.2",
|
||||||
"graphql-subscriptions": "^2.0.0",
|
"graphql-subscriptions": "^1.1.0",
|
||||||
|
"graphql-tag": "~2.10.3",
|
||||||
"graphql-upload": "^13.0.0",
|
"graphql-upload": "^13.0.0",
|
||||||
"graphql-ws": "^5.16.2",
|
|
||||||
"helmet": "~8.1.0",
|
"helmet": "~8.1.0",
|
||||||
"ioredis": "^5.9.3",
|
"ioredis": "^5.9.3",
|
||||||
"jsonwebtoken": "~8.5.1",
|
"jsonwebtoken": "~8.5.1",
|
||||||
@ -59,23 +59,24 @@
|
|||||||
"linkify-html": "^4.3.2",
|
"linkify-html": "^4.3.2",
|
||||||
"linkifyjs": "^4.3.2",
|
"linkifyjs": "^4.3.2",
|
||||||
"lodash": "~4.17.23",
|
"lodash": "~4.17.23",
|
||||||
"metascraper": "^5.49.24",
|
"merge-graphql-schemas": "^1.7.8",
|
||||||
"metascraper-author": "^5.49.24",
|
"metascraper": "^5.49.19",
|
||||||
"metascraper-date": "^5.49.24",
|
"metascraper-author": "^5.49.19",
|
||||||
"metascraper-description": "^5.49.24",
|
"metascraper-date": "^5.49.19",
|
||||||
"metascraper-image": "^5.49.24",
|
"metascraper-description": "^5.49.19",
|
||||||
"metascraper-lang": "^5.49.24",
|
"metascraper-image": "^5.49.19",
|
||||||
|
"metascraper-lang": "^5.49.19",
|
||||||
"metascraper-lang-detector": "^4.10.2",
|
"metascraper-lang-detector": "^4.10.2",
|
||||||
"metascraper-logo": "^5.49.24",
|
"metascraper-logo": "^5.49.19",
|
||||||
"metascraper-publisher": "^5.49.24",
|
"metascraper-publisher": "^5.49.19",
|
||||||
"metascraper-soundcloud": "^5.34.4",
|
"metascraper-soundcloud": "^5.34.4",
|
||||||
"metascraper-title": "^5.49.24",
|
"metascraper-title": "^5.49.19",
|
||||||
"metascraper-url": "^5.49.24",
|
"metascraper-url": "^5.49.19",
|
||||||
"metascraper-video": "^5.49.24",
|
"metascraper-video": "^5.49.19",
|
||||||
"metascraper-youtube": "^5.49.24",
|
"metascraper-youtube": "^5.49.20",
|
||||||
"migrate": "^2.1.0",
|
"migrate": "^2.1.0",
|
||||||
"mime-types": "^3.0.2",
|
"mime-types": "^3.0.2",
|
||||||
"minimatch": "^10.2.4",
|
"minimatch": "^10.2.2",
|
||||||
"mustache": "^4.2.0",
|
"mustache": "^4.2.0",
|
||||||
"neo4j-driver": "^4.4.11",
|
"neo4j-driver": "^4.4.11",
|
||||||
"neo4j-graphql-js": "2.11.5",
|
"neo4j-graphql-js": "2.11.5",
|
||||||
@ -87,34 +88,48 @@
|
|||||||
"pug": "^3.0.3",
|
"pug": "^3.0.3",
|
||||||
"sanitize-html": "~2.17.1",
|
"sanitize-html": "~2.17.1",
|
||||||
"slugify": "^1.6.6",
|
"slugify": "^1.6.6",
|
||||||
"subscriptions-transport-ws": "^0.11.0",
|
|
||||||
"trunc-html": "~1.1.2",
|
"trunc-html": "~1.1.2",
|
||||||
"tslog": "^4.10.2",
|
"tslog": "^4.10.2",
|
||||||
"uuid": "~9.0.1",
|
"uuid": "~9.0.1",
|
||||||
"validator": "^13.15.26",
|
"validator": "^13.15.26",
|
||||||
"ws": "^8.18.2",
|
|
||||||
"xregexp": "^5.1.2"
|
"xregexp": "^5.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
|
||||||
"@faker-js/faker": "9.9.0",
|
"@faker-js/faker": "9.9.0",
|
||||||
|
"@graphql-eslint/eslint-plugin": "^3.20.1",
|
||||||
"@types/email-templates": "^10.0.4",
|
"@types/email-templates": "^10.0.4",
|
||||||
"@types/jest": "^30.0.0",
|
"@types/jest": "^30.0.0",
|
||||||
"@types/jsonwebtoken": "~8.5.1",
|
"@types/jsonwebtoken": "~8.5.1",
|
||||||
"@types/lodash": "^4.17.24",
|
"@types/lodash": "^4.17.23",
|
||||||
"@types/node": "^25.3.2",
|
"@types/node": "^25.3.0",
|
||||||
"@types/request": "^2.48.13",
|
"@types/request": "^2.48.13",
|
||||||
"@types/slug": "^5.0.9",
|
"@types/slug": "^5.0.9",
|
||||||
"@types/uuid": "~9.0.1",
|
"@types/uuid": "~9.0.1",
|
||||||
"@types/ws": "^8.18.1",
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||||
"eslint": "^9.27.0",
|
"@typescript-eslint/parser": "^5.62.0",
|
||||||
"eslint-config-it4c": "^0.12.0",
|
"apollo-server-testing": "~2.11.0",
|
||||||
|
"eslint": "^8.57.1",
|
||||||
|
"eslint-config-prettier": "^10.1.8",
|
||||||
|
"eslint-config-standard": "^17.1.0",
|
||||||
|
"eslint-import-resolver-typescript": "^4.4.4",
|
||||||
|
"eslint-plugin-import": "^2.32.0",
|
||||||
|
"eslint-plugin-jest": "^29.15.0",
|
||||||
|
"eslint-plugin-jsonc": "^2.21.1",
|
||||||
|
"eslint-plugin-n": "^17.23.2",
|
||||||
|
"eslint-plugin-no-catch-all": "^1.1.0",
|
||||||
|
"eslint-plugin-prettier": "^5.5.5",
|
||||||
|
"eslint-plugin-promise": "^7.2.1",
|
||||||
|
"eslint-plugin-security": "^3.0.1",
|
||||||
"jest": "^30.2.0",
|
"jest": "^30.2.0",
|
||||||
"nodemon": "~3.1.14",
|
"nodemon": "~3.1.11",
|
||||||
"prettier": "^3.8.1",
|
"prettier": "^3.8.1",
|
||||||
|
"require-json5": "^1.3.0",
|
||||||
"rosie": "^2.1.1",
|
"rosie": "^2.1.1",
|
||||||
"ts-jest": "^29.4.6",
|
"ts-jest": "^29.4.6",
|
||||||
|
"ts-node": "^10.9.2",
|
||||||
"tsc-alias": "^1.8.16",
|
"tsc-alias": "^1.8.16",
|
||||||
"tsx": "^4.21.0",
|
"tsconfig-paths": "^4.2.0",
|
||||||
"typescript": "^5.8.3"
|
"typescript": "^5.8.3"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
@ -124,9 +139,7 @@
|
|||||||
"**/string-width": "4.2.0",
|
"**/string-width": "4.2.0",
|
||||||
"**/wrap-ansi": "7.0.0",
|
"**/wrap-ansi": "7.0.0",
|
||||||
"**/jwa": "^2.0.1",
|
"**/jwa": "^2.0.1",
|
||||||
"**/@types/express": "4.17.25",
|
"**/@types/express": "4.17.25"
|
||||||
"neo4j-graphql-js/graphql": "^16.11.0",
|
|
||||||
"graphql-upload/graphql": "^16.11.0"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.12.1"
|
"node": ">=20.12.1"
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
export { default } from 'eslint-config-it4c/prettier'
|
|
||||||
@ -1,17 +1,14 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable import-x/no-namespace */
|
|
||||||
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
|
|
||||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
|
||||||
|
|
||||||
/* eslint-disable n/no-process-env */
|
/* eslint-disable n/no-process-env */
|
||||||
import { config } from 'dotenv'
|
import { config } from 'dotenv'
|
||||||
|
// eslint-disable-next-line import/no-namespace
|
||||||
|
import * as SMTPTransport from 'nodemailer/lib/smtp-pool'
|
||||||
|
|
||||||
import emails from './emails'
|
import emails from './emails'
|
||||||
import metadata from './metadata'
|
import metadata from './metadata'
|
||||||
|
|
||||||
import type * as SMTPTransport from 'nodemailer/lib/smtp-pool'
|
|
||||||
|
|
||||||
// Load env file
|
// Load env file
|
||||||
config()
|
config()
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-shadow */
|
|
||||||
import { getDriver, getNeode } from '@db/neo4j'
|
import { getDriver, getNeode } from '@db/neo4j'
|
||||||
|
|
||||||
import type { Driver } from 'neo4j-driver'
|
import type { Driver } from 'neo4j-driver'
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
|
|
||||||
import databaseContext from '@context/database'
|
import databaseContext from '@context/database'
|
||||||
import pubsubContext from '@context/pubsub'
|
import pubsubContext from '@context/pubsub'
|
||||||
import CONFIG from '@src/config'
|
import CONFIG from '@src/config'
|
||||||
|
import type { DecodedUser } from '@src/jwt/decode'
|
||||||
import { decode } from '@src/jwt/decode'
|
import { decode } from '@src/jwt/decode'
|
||||||
import ocelotLogger from '@src/logger'
|
import ocelotLogger from '@src/logger'
|
||||||
|
import type OcelotLogger from '@src/logger'
|
||||||
|
|
||||||
import type { DecodedUser } from '@src/jwt/decode'
|
import type { ApolloServerExpressConfig } from 'apollo-server-express'
|
||||||
|
|
||||||
const serverDatabase = databaseContext()
|
const serverDatabase = databaseContext()
|
||||||
const serverPubsub = pubsubContext()
|
const serverPubsub = pubsubContext()
|
||||||
@ -14,14 +18,14 @@ export const getContext =
|
|||||||
database?: ReturnType<typeof databaseContext>
|
database?: ReturnType<typeof databaseContext>
|
||||||
pubsub?: ReturnType<typeof pubsubContext>
|
pubsub?: ReturnType<typeof pubsubContext>
|
||||||
authenticatedUser: DecodedUser | null | undefined
|
authenticatedUser: DecodedUser | null | undefined
|
||||||
logger?: typeof ocelotLogger
|
logger?: typeof OcelotLogger
|
||||||
config: typeof CONFIG
|
config: typeof CONFIG
|
||||||
}) =>
|
}) =>
|
||||||
async (req: { headers: { authorization?: string } }) => {
|
async (req: { headers: { authorization?: string } }) => {
|
||||||
const {
|
const {
|
||||||
database = serverDatabase,
|
database = serverDatabase,
|
||||||
pubsub = serverPubsub,
|
pubsub = serverPubsub,
|
||||||
authenticatedUser,
|
authenticatedUser = undefined,
|
||||||
logger = ocelotLogger,
|
logger = ocelotLogger,
|
||||||
config = CONFIG,
|
config = CONFIG,
|
||||||
} = opts ?? {}
|
} = opts ?? {}
|
||||||
@ -40,11 +44,18 @@ export const getContext =
|
|||||||
req,
|
req,
|
||||||
cypherParams: {
|
cypherParams: {
|
||||||
currentUserId: user ? user.id : null,
|
currentUserId: user ? user.id : null,
|
||||||
languageDefault: config.LANGUAGE_DEFAULT.toUpperCase(),
|
|
||||||
},
|
},
|
||||||
config,
|
config,
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const context: ApolloServerExpressConfig['context'] = async (options) => {
|
||||||
|
const { connection, req } = options
|
||||||
|
if (connection) {
|
||||||
|
return connection.context
|
||||||
|
} else {
|
||||||
|
return getContext()(req)
|
||||||
|
}
|
||||||
|
}
|
||||||
export type Context = Awaited<ReturnType<ReturnType<typeof getContext>>>
|
export type Context = Awaited<ReturnType<ReturnType<typeof getContext>>>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
import { getNeode } from './neo4j'
|
import { getNeode } from './neo4j'
|
||||||
import { trophies, verification } from './seed/badges'
|
import { trophies, verification } from './seed/badges'
|
||||||
|
|
||||||
// eslint-disable-next-line import-x/newline-after-import
|
// eslint-disable-next-line import/newline-after-import
|
||||||
;(async function () {
|
;(async function () {
|
||||||
const neode = getNeode()
|
const neode = getNeode()
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable import-x/no-commonjs */
|
/* eslint-disable import/no-commonjs */
|
||||||
// eslint-disable-next-line n/no-unpublished-require
|
// eslint-disable-next-line n/no-unpublished-require, @typescript-eslint/no-var-requires
|
||||||
const tsx = require('tsx/cjs/api')
|
const tsNode = require('ts-node')
|
||||||
|
// eslint-disable-next-line import/no-unassigned-import, n/no-unpublished-require
|
||||||
|
require('tsconfig-paths/register')
|
||||||
|
|
||||||
module.exports = tsx.register
|
module.exports = tsNode.register
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||||
/* eslint-disable @typescript-eslint/await-thenable */
|
|
||||||
import { readdir } from 'node:fs/promises'
|
import { readdir } from 'node:fs/promises'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ const run = async () => {
|
|||||||
if (args.length !== 1) {
|
if (args.length !== 1) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error('Usage: yarn run db:func:disable-notifications <email>')
|
console.error('Usage: yarn run db:func:disable-notifications <email>')
|
||||||
|
// eslint-disable-next-line n/no-process-exit
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ const run = async () => {
|
|||||||
if (!emailRegex.test(email)) {
|
if (!emailRegex.test(email)) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error('Error: Invalid email address format')
|
console.error('Error: Invalid email address format')
|
||||||
|
// eslint-disable-next-line n/no-process-exit
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,13 +46,13 @@ const run = async () => {
|
|||||||
if (result !== '1') {
|
if (result !== '1') {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error(`User with email address ${email} not found`)
|
console.error(`User with email address ${email} not found`)
|
||||||
|
// eslint-disable-next-line n/no-process-exit
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(`Notifications for User with email address ${email} disabled`)
|
console.log(`Notifications for User with email address ${email} disabled`)
|
||||||
|
// eslint-disable-next-line n/no-process-exit
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable n/no-unpublished-import */
|
|
||||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
|
||||||
import { faker } from '@faker-js/faker'
|
import { faker } from '@faker-js/faker'
|
||||||
import { hashSync } from 'bcryptjs'
|
import { hashSync } from 'bcryptjs'
|
||||||
import { Factory } from 'rosie'
|
import { Factory } from 'rosie'
|
||||||
@ -15,11 +13,10 @@ import { v4 as uuid } from 'uuid'
|
|||||||
import { generateInviteCode } from '@graphql/resolvers/inviteCodes'
|
import { generateInviteCode } from '@graphql/resolvers/inviteCodes'
|
||||||
import { isUniqueFor } from '@middleware/sluggifyMiddleware'
|
import { isUniqueFor } from '@middleware/sluggifyMiddleware'
|
||||||
import uniqueSlug from '@middleware/slugify/uniqueSlug'
|
import uniqueSlug from '@middleware/slugify/uniqueSlug'
|
||||||
|
import { Context } from '@src/context'
|
||||||
|
|
||||||
import { getDriver, getNeode } from './neo4j'
|
import { getDriver, getNeode } from './neo4j'
|
||||||
|
|
||||||
import type { Context } from '@src/context'
|
|
||||||
|
|
||||||
const neode = getNeode()
|
const neode = getNeode()
|
||||||
|
|
||||||
const uniqueImageUrl = (imageUrl) => {
|
const uniqueImageUrl = (imageUrl) => {
|
||||||
@ -52,14 +49,14 @@ Factory.define('category')
|
|||||||
.attr('id', uuid)
|
.attr('id', uuid)
|
||||||
.attr('icon', 'globe')
|
.attr('icon', 'globe')
|
||||||
.attr('name', 'Global Peace & Nonviolence')
|
.attr('name', 'Global Peace & Nonviolence')
|
||||||
.after(async (buildObject, _options) => {
|
.after((buildObject, _options) => {
|
||||||
return neode.create('Category', buildObject)
|
return neode.create('Category', buildObject)
|
||||||
})
|
})
|
||||||
|
|
||||||
Factory.define('badge')
|
Factory.define('badge')
|
||||||
.attr('type', 'crowdfunding')
|
.attr('type', 'crowdfunding')
|
||||||
.attr('status', 'permanent')
|
.attr('status', 'permanent')
|
||||||
.after(async (buildObject, _options) => {
|
.after((buildObject, _options) => {
|
||||||
return neode.create('Badge', buildObject)
|
return neode.create('Badge', buildObject)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -70,7 +67,7 @@ Factory.define('image')
|
|||||||
.attr('alt', faker.lorem.sentence)
|
.attr('alt', faker.lorem.sentence)
|
||||||
.attr('type', 'image/jpeg')
|
.attr('type', 'image/jpeg')
|
||||||
.attr('url', null)
|
.attr('url', null)
|
||||||
.after(async (buildObject, _options) => {
|
.after((buildObject, _options) => {
|
||||||
if (!buildObject.url) {
|
if (!buildObject.url) {
|
||||||
buildObject.url = faker.image.urlPicsumPhotos({
|
buildObject.url = faker.image.urlPicsumPhotos({
|
||||||
width: buildObject.width,
|
width: buildObject.width,
|
||||||
@ -87,7 +84,7 @@ Factory.define('file')
|
|||||||
.attr('name', faker.lorem.slug)
|
.attr('name', faker.lorem.slug)
|
||||||
.attr('type', 'image/jpeg')
|
.attr('type', 'image/jpeg')
|
||||||
.attr('url', null)
|
.attr('url', null)
|
||||||
.after(async (buildObject, _options) => {
|
.after((buildObject, _options) => {
|
||||||
if (!buildObject.url) {
|
if (!buildObject.url) {
|
||||||
buildObject.url = faker.image.urlPicsumPhotos()
|
buildObject.url = faker.image.urlPicsumPhotos()
|
||||||
}
|
}
|
||||||
@ -174,8 +171,8 @@ Factory.define('post')
|
|||||||
return Promise.all([Factory.build('category')])
|
return Promise.all([Factory.build('category')])
|
||||||
}) */
|
}) */
|
||||||
.option('tagIds', [])
|
.option('tagIds', [])
|
||||||
.option('tags', ['tagIds'], async (tagIds) => {
|
.option('tags', ['tagIds'], (tagIds) => {
|
||||||
return Promise.all(tagIds.map(async (id) => neode.find('Tag', id)))
|
return Promise.all(tagIds.map((id) => neode.find('Tag', id)))
|
||||||
})
|
})
|
||||||
.option('authorId', null)
|
.option('authorId', null)
|
||||||
.option('author', ['authorId'], (authorId) => {
|
.option('author', ['authorId'], (authorId) => {
|
||||||
@ -267,7 +264,7 @@ Factory.define('donations')
|
|||||||
.attr('showDonations', true)
|
.attr('showDonations', true)
|
||||||
.attr('goal', 15000)
|
.attr('goal', 15000)
|
||||||
.attr('progress', 7000)
|
.attr('progress', 7000)
|
||||||
.after(async (buildObject, _options) => {
|
.after((buildObject, _options) => {
|
||||||
return neode.create('Donations', buildObject)
|
return neode.create('Donations', buildObject)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -278,13 +275,13 @@ const emailDefaults = {
|
|||||||
|
|
||||||
Factory.define('emailAddress')
|
Factory.define('emailAddress')
|
||||||
.attrs(emailDefaults)
|
.attrs(emailDefaults)
|
||||||
.after(async (buildObject, _options) => {
|
.after((buildObject, _options) => {
|
||||||
return neode.create('EmailAddress', buildObject)
|
return neode.create('EmailAddress', buildObject)
|
||||||
})
|
})
|
||||||
|
|
||||||
Factory.define('unverifiedEmailAddress')
|
Factory.define('unverifiedEmailAddress')
|
||||||
.attr(emailDefaults)
|
.attr(emailDefaults)
|
||||||
.after(async (buildObject, _options) => {
|
.after((buildObject, _options) => {
|
||||||
return neode.create('UnverifiedEmailAddress', buildObject)
|
return neode.create('UnverifiedEmailAddress', buildObject)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -297,7 +294,7 @@ const inviteCodeDefaults = {
|
|||||||
Factory.define('inviteCode')
|
Factory.define('inviteCode')
|
||||||
.attrs(inviteCodeDefaults)
|
.attrs(inviteCodeDefaults)
|
||||||
.option('groupId', null)
|
.option('groupId', null)
|
||||||
.option('group', ['groupId'], async (groupId) => {
|
.option('group', ['groupId'], (groupId) => {
|
||||||
if (groupId) {
|
if (groupId) {
|
||||||
return neode.find('Group', groupId)
|
return neode.find('Group', groupId)
|
||||||
}
|
}
|
||||||
@ -334,11 +331,11 @@ Factory.define('location')
|
|||||||
id: 'country.10743216036480410',
|
id: 'country.10743216036480410',
|
||||||
type: 'country',
|
type: 'country',
|
||||||
})
|
})
|
||||||
.after(async (buildObject, _options) => {
|
.after((buildObject, _options) => {
|
||||||
return neode.create('Location', buildObject)
|
return neode.create('Location', buildObject)
|
||||||
})
|
})
|
||||||
|
|
||||||
Factory.define('report').after(async (buildObject, _options) => {
|
Factory.define('report').after((buildObject, _options) => {
|
||||||
return neode.create('Report', buildObject)
|
return neode.create('Report', buildObject)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -346,7 +343,7 @@ Factory.define('tag')
|
|||||||
.attrs({
|
.attrs({
|
||||||
name: '#human-connection',
|
name: '#human-connection',
|
||||||
})
|
})
|
||||||
.after(async (buildObject, _options) => {
|
.after((buildObject, _options) => {
|
||||||
return neode.create('Tag', buildObject)
|
return neode.create('Tag', buildObject)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -354,7 +351,7 @@ Factory.define('socialMedia')
|
|||||||
.attrs({
|
.attrs({
|
||||||
url: 'https://mastodon.social/@Gargron',
|
url: 'https://mastodon.social/@Gargron',
|
||||||
})
|
})
|
||||||
.after(async (buildObject, _options) => {
|
.after((buildObject, _options) => {
|
||||||
return neode.create('SocialMedia', buildObject)
|
return neode.create('SocialMedia', buildObject)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable @typescript-eslint/no-confusing-void-expression */
|
|
||||||
import { getDriver, getNeode } from '@db/neo4j'
|
import { getDriver, getNeode } from '@db/neo4j'
|
||||||
|
|
||||||
class Store {
|
class Store {
|
||||||
@ -84,7 +83,7 @@ class Store {
|
|||||||
const driver = getDriver()
|
const driver = getDriver()
|
||||||
const session = driver.session()
|
const session = driver.session()
|
||||||
const { migrations } = set
|
const { migrations } = set
|
||||||
const writeTxResultPromise = session.writeTransaction(async (txc) => {
|
const writeTxResultPromise = session.writeTransaction((txc) => {
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
migrations.map(async (migration) => {
|
migrations.map(async (migration) => {
|
||||||
const { title, description, timestamp } = migration
|
const { title, description, timestamp } = migration
|
||||||
|
|||||||
@ -4,9 +4,8 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable import-x/no-extraneous-dependencies */
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
/* eslint-disable promise/prefer-await-to-callbacks */
|
/* eslint-disable promise/prefer-await-to-callbacks */
|
||||||
/* eslint-disable import-x/no-deprecated */
|
|
||||||
import { throwError, concat } from 'rxjs'
|
import { throwError, concat } from 'rxjs'
|
||||||
import { flatMap, mergeMap, map, catchError, filter } from 'rxjs/operators'
|
import { flatMap, mergeMap, map, catchError, filter } from 'rxjs/operators'
|
||||||
|
|
||||||
@ -72,7 +71,7 @@ export function up(next) {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: ({ user, email, _oldUser, oldEmail }) => {
|
next: ({ user, email, _oldUser, oldEmail }) =>
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(`
|
console.log(`
|
||||||
Merged:
|
Merged:
|
||||||
@ -80,8 +79,7 @@ export function up(next) {
|
|||||||
userId: ${user.id}
|
userId: ${user.id}
|
||||||
email: ${oldEmail} => ${email.email}
|
email: ${oldEmail} => ${email.email}
|
||||||
=============================
|
=============================
|
||||||
`)
|
`),
|
||||||
},
|
|
||||||
complete: () => {
|
complete: () => {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log('Merging of duplicate users completed')
|
console.log('Merging of duplicate users completed')
|
||||||
|
|||||||
@ -4,9 +4,8 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable import-x/no-extraneous-dependencies */
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
/* eslint-disable promise/prefer-await-to-callbacks */
|
/* eslint-disable promise/prefer-await-to-callbacks */
|
||||||
/* eslint-disable import-x/no-deprecated */
|
|
||||||
import { throwError, concat } from 'rxjs'
|
import { throwError, concat } from 'rxjs'
|
||||||
import { flatMap, mergeMap, map, catchError } from 'rxjs/operators'
|
import { flatMap, mergeMap, map, catchError } from 'rxjs/operators'
|
||||||
|
|
||||||
@ -66,7 +65,7 @@ export function up(next) {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: ({ updatedLocation, location }) => {
|
next: ({ updatedLocation, location }) =>
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(`
|
console.log(`
|
||||||
Merged:
|
Merged:
|
||||||
@ -74,8 +73,7 @@ export function up(next) {
|
|||||||
locationId: ${location.id}
|
locationId: ${location.id}
|
||||||
updatedLocation: ${location.id} => ${updatedLocation.id}
|
updatedLocation: ${location.id} => ${updatedLocation.id}
|
||||||
=============================
|
=============================
|
||||||
`)
|
`),
|
||||||
},
|
|
||||||
complete: () => {
|
complete: () => {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log('Merging of duplicate locations completed')
|
console.log('Merging of duplicate locations completed')
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
export async function up(_next) {}
|
export async function up(_next) {}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||||
/* eslint-disable @typescript-eslint/await-thenable */
|
|
||||||
|
|
||||||
import { open } from 'node:fs/promises'
|
import { open } from 'node:fs/promises'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
|
|||||||
@ -13,7 +13,6 @@ export default {
|
|||||||
nameNL: { type: 'string' },
|
nameNL: { type: 'string' },
|
||||||
namePL: { type: 'string' },
|
namePL: { type: 'string' },
|
||||||
nameRU: { type: 'string' },
|
nameRU: { type: 'string' },
|
||||||
nameSQ: { type: 'string' },
|
|
||||||
isIn: {
|
isIn: {
|
||||||
type: 'relationship',
|
type: 'relationship',
|
||||||
relationship: 'IS_IN',
|
relationship: 'IS_IN',
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||||
/* eslint-disable jest/valid-title */
|
|
||||||
|
|
||||||
import { cleanDatabase } from '@db/factories'
|
import { cleanDatabase } from '@db/factories'
|
||||||
import { getNeode, getDriver } from '@db/neo4j'
|
import { getNeode, getDriver } from '@db/neo4j'
|
||||||
@ -66,8 +65,8 @@ describe('slug', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('characters', () => {
|
describe('characters', () => {
|
||||||
const createUser = async (attrs) => {
|
const createUser = (attrs) => {
|
||||||
return neode.create('User', attrs).then(async (user) => user.toJson())
|
return neode.create('User', attrs).then((user) => user.toJson())
|
||||||
}
|
}
|
||||||
|
|
||||||
it('-', async () => {
|
it('-', async () => {
|
||||||
@ -82,7 +81,7 @@ describe('slug', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('', async () => {
|
it(' ', async () => {
|
||||||
await expect(createUser({ slug: 'matt rider' })).rejects.toThrow('ERROR_VALIDATION')
|
await expect(createUser({ slug: 'matt rider' })).rejects.toThrow('ERROR_VALIDATION')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
/* eslint-disable import-x/no-named-as-default-member */
|
/* eslint-disable import/no-named-as-default-member */
|
||||||
import neo4j from 'neo4j-driver'
|
import neo4j, { Driver } from 'neo4j-driver'
|
||||||
import Neode from 'neode'
|
import Neode from 'neode'
|
||||||
|
|
||||||
import CONFIG from '@config/index'
|
import CONFIG from '@config/index'
|
||||||
import models from '@db/models/index'
|
import models from '@db/models/index'
|
||||||
|
|
||||||
import type { Driver } from 'neo4j-driver'
|
|
||||||
|
|
||||||
let driver: Driver
|
let driver: Driver
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
uri: CONFIG.NEO4J_URI,
|
uri: CONFIG.NEO4J_URI,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||||
|
/* eslint-disable n/no-process-exit */
|
||||||
import CONFIG from '@config/index'
|
import CONFIG from '@config/index'
|
||||||
|
|
||||||
import { cleanDatabase } from './factories'
|
import { cleanDatabase } from './factories'
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||||
|
/* eslint-disable n/no-process-exit */
|
||||||
import CONFIG from '@config/index'
|
import CONFIG from '@config/index'
|
||||||
|
|
||||||
import { cleanDatabase } from './factories'
|
import { cleanDatabase } from './factories'
|
||||||
|
|||||||
@ -2,22 +2,19 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||||
/* eslint-disable n/no-unpublished-import */
|
/* eslint-disable n/no-process-exit */
|
||||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
|
||||||
/* eslint-disable @typescript-eslint/no-confusing-void-expression */
|
|
||||||
|
|
||||||
import { faker } from '@faker-js/faker'
|
import { faker } from '@faker-js/faker'
|
||||||
import sample from 'lodash/sample'
|
import sample from 'lodash/sample'
|
||||||
|
|
||||||
import CONFIG from '@config/index'
|
import CONFIG from '@config/index'
|
||||||
import { categories } from '@constants/categories'
|
import { categories } from '@constants/categories'
|
||||||
import CreateComment from '@graphql/queries/comments/CreateComment.gql'
|
import { ChangeGroupMemberRole } from '@graphql/queries/ChangeGroupMemberRole'
|
||||||
import ChangeGroupMemberRole from '@graphql/queries/groups/ChangeGroupMemberRole.gql'
|
import { CreateComment } from '@graphql/queries/CreateComment'
|
||||||
import CreateGroup from '@graphql/queries/groups/CreateGroup.gql'
|
import { CreateGroup } from '@graphql/queries/CreateGroup'
|
||||||
import JoinGroup from '@graphql/queries/groups/JoinGroup.gql'
|
import { CreateMessage } from '@graphql/queries/CreateMessage'
|
||||||
import CreateMessage from '@graphql/queries/messaging/CreateMessage.gql'
|
import { CreatePost } from '@graphql/queries/CreatePost'
|
||||||
import CreateRoom from '@graphql/queries/messaging/CreateRoom.gql'
|
import { CreateRoom } from '@graphql/queries/CreateRoom'
|
||||||
import CreatePost from '@graphql/queries/posts/CreatePost.gql'
|
import { JoinGroup } from '@graphql/queries/JoinGroup'
|
||||||
import { createApolloTestSetup } from '@root/test/helpers'
|
import { createApolloTestSetup } from '@root/test/helpers'
|
||||||
|
|
||||||
import Factory from './factories'
|
import Factory from './factories'
|
||||||
@ -42,7 +39,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
|||||||
authenticatedUser,
|
authenticatedUser,
|
||||||
config: CONFIG,
|
config: CONFIG,
|
||||||
})
|
})
|
||||||
const apolloSetup = await createApolloTestSetup({ context })
|
const apolloSetup = createApolloTestSetup({ context })
|
||||||
const { mutate, server, database } = apolloSetup
|
const { mutate, server, database } = apolloSetup
|
||||||
const { neode } = database
|
const { neode } = database
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Integer, Node } from 'neo4j-driver'
|
import { Integer, Node } from 'neo4j-driver'
|
||||||
|
|
||||||
export interface CategoryDbProperties {
|
export interface CategoryDbProperties {
|
||||||
createdAt: string
|
createdAt: string
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Integer, Node } from 'neo4j-driver'
|
import { Integer, Node } from 'neo4j-driver'
|
||||||
|
|
||||||
export interface CommentDbProperties {
|
export interface CommentDbProperties {
|
||||||
content: string
|
content: string
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Integer, Node } from 'neo4j-driver'
|
import { Integer, Node } from 'neo4j-driver'
|
||||||
|
|
||||||
export interface EmailAddressDbProperties {
|
export interface EmailAddressDbProperties {
|
||||||
createdAt: string
|
createdAt: string
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import type { PostDbProperties } from './Post'
|
import { Integer, Node } from 'neo4j-driver'
|
||||||
import type { Integer, Node } from 'neo4j-driver'
|
|
||||||
|
import { PostDbProperties } from './Post'
|
||||||
|
|
||||||
export interface EventDbProperties extends PostDbProperties {
|
export interface EventDbProperties extends PostDbProperties {
|
||||||
eventIsOnline: boolean
|
eventIsOnline: boolean
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Integer, Node } from 'neo4j-driver'
|
import { Integer, Node } from 'neo4j-driver'
|
||||||
|
|
||||||
export interface GroupDbProperties {
|
export interface GroupDbProperties {
|
||||||
about: string
|
about: string
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Integer, Node } from 'neo4j-driver'
|
import { Integer, Node } from 'neo4j-driver'
|
||||||
|
|
||||||
export interface ImageDbProperties {
|
export interface ImageDbProperties {
|
||||||
alt: string
|
alt: string
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Integer, Node } from 'neo4j-driver'
|
import { Integer, Node } from 'neo4j-driver'
|
||||||
|
|
||||||
export interface InviteCodeDbProperties {
|
export interface InviteCodeDbProperties {
|
||||||
code: string
|
code: string
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Integer, Node } from 'neo4j-driver'
|
import { Integer, Node } from 'neo4j-driver'
|
||||||
|
|
||||||
export interface LocationDbProperties {
|
export interface LocationDbProperties {
|
||||||
id: string
|
id: string
|
||||||
@ -14,7 +14,6 @@ export interface LocationDbProperties {
|
|||||||
namePL: string
|
namePL: string
|
||||||
namePT: string
|
namePT: string
|
||||||
nameRU: string
|
nameRU: string
|
||||||
nameSQ: string
|
|
||||||
type: string
|
type: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Integer, Node } from 'neo4j-driver'
|
import { Integer, Node } from 'neo4j-driver'
|
||||||
|
|
||||||
export interface MessageDbProperties {
|
export interface MessageDbProperties {
|
||||||
content: string
|
content: string
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Integer, Node } from 'neo4j-driver'
|
import { Integer, Node } from 'neo4j-driver'
|
||||||
|
|
||||||
export interface PostDbProperties {
|
export interface PostDbProperties {
|
||||||
clickedCount: number
|
clickedCount: number
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Integer, Node } from 'neo4j-driver'
|
import { Integer, Node } from 'neo4j-driver'
|
||||||
|
|
||||||
export interface ReportDbProperties {
|
export interface ReportDbProperties {
|
||||||
closed: boolean
|
closed: boolean
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Integer, Node } from 'neo4j-driver'
|
import { Integer, Node } from 'neo4j-driver'
|
||||||
|
|
||||||
export interface TagDbProperties {
|
export interface TagDbProperties {
|
||||||
deleted: boolean
|
deleted: boolean
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Integer, Node } from 'neo4j-driver'
|
import { Integer, Node } from 'neo4j-driver'
|
||||||
|
|
||||||
export interface UserDbProperties {
|
export interface UserDbProperties {
|
||||||
allowEmbedIframes: boolean
|
allowEmbedIframes: boolean
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import CONFIG from '@config/index'
|
|||||||
|
|
||||||
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
||||||
|
|
||||||
// eslint-disable-next-line import-x/first
|
// eslint-disable-next-line import/first
|
||||||
import { sendChatMessageMail } from './sendEmail'
|
import { sendChatMessageMail } from './sendEmail'
|
||||||
|
|
||||||
const senderUser = {
|
const senderUser = {
|
||||||
|
|||||||
@ -12,8 +12,7 @@ import { createTransport } from 'nodemailer'
|
|||||||
import CONFIG, { nodemailerTransportOptions } from '@config/index'
|
import CONFIG, { nodemailerTransportOptions } from '@config/index'
|
||||||
import logosWebapp from '@config/logosBranded'
|
import logosWebapp from '@config/logosBranded'
|
||||||
import metadata from '@config/metadata'
|
import metadata from '@config/metadata'
|
||||||
|
import { UserDbProperties } from '@db/types/User'
|
||||||
import type { UserDbProperties } from '@db/types/User'
|
|
||||||
|
|
||||||
const welcomeImageUrl = new URL(logosWebapp.LOGO_WELCOME_PATH, CONFIG.CLIENT_URI)
|
const welcomeImageUrl = new URL(logosWebapp.LOGO_WELCOME_PATH, CONFIG.CLIENT_URI)
|
||||||
const settingsUrl = new URL('/settings/notifications', CONFIG.CLIENT_URI)
|
const settingsUrl = new URL('/settings/notifications', CONFIG.CLIENT_URI)
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import CONFIG from '@config/index'
|
|||||||
|
|
||||||
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
||||||
|
|
||||||
// eslint-disable-next-line import-x/first
|
// eslint-disable-next-line import/first
|
||||||
import { sendEmailVerification } from './sendEmail'
|
import { sendEmailVerification } from './sendEmail'
|
||||||
|
|
||||||
describe('sendEmailVerification', () => {
|
describe('sendEmailVerification', () => {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import CONFIG from '@config/index'
|
|||||||
|
|
||||||
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
||||||
|
|
||||||
// eslint-disable-next-line import-x/first
|
// eslint-disable-next-line import/first
|
||||||
import { sendNotificationMail } from './sendEmail'
|
import { sendNotificationMail } from './sendEmail'
|
||||||
|
|
||||||
describe('sendNotificationMail', () => {
|
describe('sendNotificationMail', () => {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import CONFIG from '@config/index'
|
|||||||
|
|
||||||
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
||||||
|
|
||||||
// eslint-disable-next-line import-x/first
|
// eslint-disable-next-line import/first
|
||||||
import { sendRegistrationMail } from './sendEmail'
|
import { sendRegistrationMail } from './sendEmail'
|
||||||
|
|
||||||
describe('sendRegistrationMail', () => {
|
describe('sendRegistrationMail', () => {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import CONFIG from '@config/index'
|
|||||||
|
|
||||||
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
||||||
|
|
||||||
// eslint-disable-next-line import-x/first
|
// eslint-disable-next-line import/first
|
||||||
import { sendResetPasswordMail } from './sendEmail'
|
import { sendResetPasswordMail } from './sendEmail'
|
||||||
|
|
||||||
describe('sendResetPasswordMail', () => {
|
describe('sendResetPasswordMail', () => {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import CONFIG from '@config/index'
|
|||||||
|
|
||||||
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
||||||
|
|
||||||
// eslint-disable-next-line import-x/first
|
// eslint-disable-next-line import/first
|
||||||
import { sendWrongEmail } from './sendEmail'
|
import { sendWrongEmail } from './sendEmail'
|
||||||
|
|
||||||
describe('sendWrongEmail', () => {
|
describe('sendWrongEmail', () => {
|
||||||
|
|||||||
6
backend/src/graphql.d.ts
vendored
6
backend/src/graphql.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
declare module '*.gql' {
|
|
||||||
import type { DocumentNode } from 'graphql'
|
|
||||||
|
|
||||||
const value: DocumentNode
|
|
||||||
export default value
|
|
||||||
}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
import { GraphQLError } from 'graphql'
|
|
||||||
|
|
||||||
export class UserInputError extends GraphQLError {
|
|
||||||
constructor(message: string) {
|
|
||||||
super(message, { extensions: { code: 'BAD_USER_INPUT' } })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class AuthenticationError extends GraphQLError {
|
|
||||||
constructor(message: string) {
|
|
||||||
super(message, { extensions: { code: 'UNAUTHENTICATED' } })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ForbiddenError extends GraphQLError {
|
|
||||||
constructor(message: string) {
|
|
||||||
super(message, { extensions: { code: 'FORBIDDEN' } })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
/* eslint-disable n/no-sync, security/detect-non-literal-fs-filename */
|
|
||||||
// Register a require hook for .gql files so they can be imported at runtime.
|
|
||||||
// Jest uses its own graphqlTransform.ts for this; this hook covers tsx/node usage
|
|
||||||
// (e.g. db:seed).
|
|
||||||
import { readFileSync } from 'node:fs'
|
|
||||||
import Module from 'node:module'
|
|
||||||
|
|
||||||
import { parse } from 'graphql'
|
|
||||||
|
|
||||||
// @ts-expect-error -- require.extensions is deprecated but still functional for CJS hooks
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
||||||
Module._extensions['.gql'] = function (_module: typeof module, filename: string) {
|
|
||||||
const content = readFileSync(filename, 'utf-8')
|
|
||||||
try {
|
|
||||||
_module.exports = parse(content)
|
|
||||||
} catch (error: unknown) {
|
|
||||||
throw new Error(
|
|
||||||
`Failed to parse ${filename}: ${error instanceof Error ? error.message : String(error)}`,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
11
backend/src/graphql/queries/AddEmailAddress.ts
Normal file
11
backend/src/graphql/queries/AddEmailAddress.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const AddEmailAddress = gql`
|
||||||
|
mutation ($email: String!) {
|
||||||
|
AddEmailAddress(email: $email) {
|
||||||
|
email
|
||||||
|
verifiedAt
|
||||||
|
createdAt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
15
backend/src/graphql/queries/AddPostEmotions.ts
Normal file
15
backend/src/graphql/queries/AddPostEmotions.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const AddPostEmotions = gql`
|
||||||
|
mutation ($to: _PostInput!, $data: _EMOTEDInput!) {
|
||||||
|
AddPostEmotions(to: $to, data: $data) {
|
||||||
|
from {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
emotion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
@ -1,8 +0,0 @@
|
|||||||
query Category {
|
|
||||||
Category {
|
|
||||||
id
|
|
||||||
slug
|
|
||||||
name
|
|
||||||
icon
|
|
||||||
}
|
|
||||||
}
|
|
||||||
12
backend/src/graphql/queries/Category.ts
Normal file
12
backend/src/graphql/queries/Category.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const Category = gql`
|
||||||
|
query {
|
||||||
|
Category {
|
||||||
|
id
|
||||||
|
slug
|
||||||
|
name
|
||||||
|
icon
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
16
backend/src/graphql/queries/ChangeGroupMemberRole.ts
Normal file
16
backend/src/graphql/queries/ChangeGroupMemberRole.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const ChangeGroupMemberRole = gql`
|
||||||
|
mutation ($groupId: ID!, $userId: ID!, $roleInGroup: GroupMemberRole!) {
|
||||||
|
ChangeGroupMemberRole(groupId: $groupId, userId: $userId, roleInGroup: $roleInGroup) {
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
membership {
|
||||||
|
role
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
15
backend/src/graphql/queries/CreateComment.ts
Normal file
15
backend/src/graphql/queries/CreateComment.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const CreateComment = gql`
|
||||||
|
mutation ($id: ID, $postId: ID!, $content: String!) {
|
||||||
|
CreateComment(id: $id, postId: $postId, content: $content) {
|
||||||
|
id
|
||||||
|
content
|
||||||
|
author {
|
||||||
|
name
|
||||||
|
}
|
||||||
|
isPostObservedByMe
|
||||||
|
postObservingUsersCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
53
backend/src/graphql/queries/CreateGroup.ts
Normal file
53
backend/src/graphql/queries/CreateGroup.ts
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const CreateGroup = gql`
|
||||||
|
mutation (
|
||||||
|
$id: ID
|
||||||
|
$name: String!
|
||||||
|
$slug: String
|
||||||
|
$about: String
|
||||||
|
$description: String!
|
||||||
|
$groupType: GroupType!
|
||||||
|
$actionRadius: GroupActionRadius!
|
||||||
|
$categoryIds: [ID]
|
||||||
|
$locationName: String # empty string '' sets it to null
|
||||||
|
) {
|
||||||
|
CreateGroup(
|
||||||
|
id: $id
|
||||||
|
name: $name
|
||||||
|
slug: $slug
|
||||||
|
about: $about
|
||||||
|
description: $description
|
||||||
|
groupType: $groupType
|
||||||
|
actionRadius: $actionRadius
|
||||||
|
categoryIds: $categoryIds
|
||||||
|
locationName: $locationName
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
createdAt
|
||||||
|
updatedAt
|
||||||
|
disabled
|
||||||
|
deleted
|
||||||
|
about
|
||||||
|
description
|
||||||
|
descriptionExcerpt
|
||||||
|
groupType
|
||||||
|
actionRadius
|
||||||
|
categories {
|
||||||
|
id
|
||||||
|
slug
|
||||||
|
name
|
||||||
|
icon
|
||||||
|
}
|
||||||
|
locationName
|
||||||
|
location {
|
||||||
|
name
|
||||||
|
nameDE
|
||||||
|
nameEN
|
||||||
|
}
|
||||||
|
myRole
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
22
backend/src/graphql/queries/CreateMessage.ts
Normal file
22
backend/src/graphql/queries/CreateMessage.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const CreateMessage = gql`
|
||||||
|
mutation ($roomId: ID!, $content: String!, $files: [FileInput]) {
|
||||||
|
CreateMessage(roomId: $roomId, content: $content, files: $files) {
|
||||||
|
id
|
||||||
|
content
|
||||||
|
senderId
|
||||||
|
username
|
||||||
|
avatar
|
||||||
|
date
|
||||||
|
saved
|
||||||
|
distributed
|
||||||
|
seen
|
||||||
|
files {
|
||||||
|
url
|
||||||
|
name
|
||||||
|
type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
51
backend/src/graphql/queries/CreatePost.ts
Normal file
51
backend/src/graphql/queries/CreatePost.ts
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const CreatePost = gql`
|
||||||
|
mutation (
|
||||||
|
$id: ID
|
||||||
|
$title: String!
|
||||||
|
$slug: String
|
||||||
|
$content: String!
|
||||||
|
$categoryIds: [ID]
|
||||||
|
$groupId: ID
|
||||||
|
$postType: PostType
|
||||||
|
$eventInput: _EventInput
|
||||||
|
) {
|
||||||
|
CreatePost(
|
||||||
|
id: $id
|
||||||
|
title: $title
|
||||||
|
slug: $slug
|
||||||
|
content: $content
|
||||||
|
categoryIds: $categoryIds
|
||||||
|
groupId: $groupId
|
||||||
|
postType: $postType
|
||||||
|
eventInput: $eventInput
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
slug
|
||||||
|
title
|
||||||
|
content
|
||||||
|
disabled
|
||||||
|
deleted
|
||||||
|
postType
|
||||||
|
author {
|
||||||
|
name
|
||||||
|
}
|
||||||
|
categories {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
eventStart
|
||||||
|
eventEnd
|
||||||
|
eventLocationName
|
||||||
|
eventVenue
|
||||||
|
eventIsOnline
|
||||||
|
eventLocation {
|
||||||
|
lng
|
||||||
|
lat
|
||||||
|
}
|
||||||
|
isObservedByMe
|
||||||
|
observingUsersCount
|
||||||
|
language
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
22
backend/src/graphql/queries/CreateRoom.ts
Normal file
22
backend/src/graphql/queries/CreateRoom.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const CreateRoom = gql`
|
||||||
|
mutation ($userId: ID!) {
|
||||||
|
CreateRoom(userId: $userId) {
|
||||||
|
id
|
||||||
|
roomId
|
||||||
|
roomName
|
||||||
|
lastMessageAt
|
||||||
|
unreadCount
|
||||||
|
#avatar
|
||||||
|
users {
|
||||||
|
_id
|
||||||
|
id
|
||||||
|
name
|
||||||
|
avatar {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
14
backend/src/graphql/queries/CreateSocialMedia.ts
Normal file
14
backend/src/graphql/queries/CreateSocialMedia.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const CreateSocialMedia = gql`
|
||||||
|
mutation ($url: String!) {
|
||||||
|
CreateSocialMedia(url: $url) {
|
||||||
|
id
|
||||||
|
url
|
||||||
|
url
|
||||||
|
ownedBy {
|
||||||
|
name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
12
backend/src/graphql/queries/DeleteComment.ts
Normal file
12
backend/src/graphql/queries/DeleteComment.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const DeleteComment = gql`
|
||||||
|
mutation ($id: ID!) {
|
||||||
|
DeleteComment(id: $id) {
|
||||||
|
id
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
deleted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
20
backend/src/graphql/queries/DeletePost.ts
Normal file
20
backend/src/graphql/queries/DeletePost.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const DeletePost = gql`
|
||||||
|
mutation ($id: ID!) {
|
||||||
|
DeletePost(id: $id) {
|
||||||
|
id
|
||||||
|
deleted
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
image {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
comments {
|
||||||
|
deleted
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
10
backend/src/graphql/queries/DeleteSocialMedia.ts
Normal file
10
backend/src/graphql/queries/DeleteSocialMedia.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const DeleteSocialMedia = gql`
|
||||||
|
mutation ($id: ID!) {
|
||||||
|
DeleteSocialMedia(id: $id) {
|
||||||
|
id
|
||||||
|
url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
30
backend/src/graphql/queries/DeleteUser.ts
Normal file
30
backend/src/graphql/queries/DeleteUser.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const DeleteUser = gql`
|
||||||
|
mutation ($id: ID!, $resource: [Deletable]) {
|
||||||
|
DeleteUser(id: $id, resource: $resource) {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
about
|
||||||
|
deleted
|
||||||
|
contributions {
|
||||||
|
id
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
deleted
|
||||||
|
comments {
|
||||||
|
id
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
deleted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
comments {
|
||||||
|
id
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
deleted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
12
backend/src/graphql/queries/Donations.ts
Normal file
12
backend/src/graphql/queries/Donations.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const Donations = gql`
|
||||||
|
query {
|
||||||
|
Donations {
|
||||||
|
id
|
||||||
|
showDonations
|
||||||
|
goal
|
||||||
|
progress
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
40
backend/src/graphql/queries/Group.ts
Normal file
40
backend/src/graphql/queries/Group.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const Group = gql`
|
||||||
|
query Group($isMember: Boolean, $id: ID, $slug: String) {
|
||||||
|
Group(isMember: $isMember, id: $id, slug: $slug) {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
createdAt
|
||||||
|
updatedAt
|
||||||
|
disabled
|
||||||
|
deleted
|
||||||
|
about
|
||||||
|
description
|
||||||
|
descriptionExcerpt
|
||||||
|
groupType
|
||||||
|
actionRadius
|
||||||
|
categories {
|
||||||
|
id
|
||||||
|
slug
|
||||||
|
name
|
||||||
|
icon
|
||||||
|
}
|
||||||
|
avatar {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
locationName
|
||||||
|
location {
|
||||||
|
name
|
||||||
|
nameDE
|
||||||
|
nameEN
|
||||||
|
}
|
||||||
|
myRole
|
||||||
|
inviteCodes {
|
||||||
|
code
|
||||||
|
redeemedByCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
16
backend/src/graphql/queries/GroupMembers.ts
Normal file
16
backend/src/graphql/queries/GroupMembers.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const GroupMembers = gql`
|
||||||
|
query GroupMembers($id: ID!) {
|
||||||
|
GroupMembers(id: $id) {
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
membership {
|
||||||
|
role
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
16
backend/src/graphql/queries/JoinGroup.ts
Normal file
16
backend/src/graphql/queries/JoinGroup.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const JoinGroup = gql`
|
||||||
|
mutation ($groupId: ID!, $userId: ID!) {
|
||||||
|
JoinGroup(groupId: $groupId, userId: $userId) {
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
membership {
|
||||||
|
role
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
16
backend/src/graphql/queries/LeaveGroup.ts
Normal file
16
backend/src/graphql/queries/LeaveGroup.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const LeaveGroup = gql`
|
||||||
|
mutation ($groupId: ID!, $userId: ID!) {
|
||||||
|
LeaveGroup(groupId: $groupId, userId: $userId) {
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
membership {
|
||||||
|
role
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
7
backend/src/graphql/queries/MarkMessagesAsSeen.ts
Normal file
7
backend/src/graphql/queries/MarkMessagesAsSeen.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const MarkMessagesAsSeen = gql`
|
||||||
|
mutation ($messageIds: [String!]) {
|
||||||
|
MarkMessagesAsSeen(messageIds: $messageIds)
|
||||||
|
}
|
||||||
|
`
|
||||||
27
backend/src/graphql/queries/Message.ts
Normal file
27
backend/src/graphql/queries/Message.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const Message = gql`
|
||||||
|
query ($roomId: ID!, $first: Int, $offset: Int) {
|
||||||
|
Message(roomId: $roomId, first: $first, offset: $offset, orderBy: indexId_desc) {
|
||||||
|
_id
|
||||||
|
id
|
||||||
|
indexId
|
||||||
|
content
|
||||||
|
senderId
|
||||||
|
author {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
username
|
||||||
|
avatar
|
||||||
|
date
|
||||||
|
saved
|
||||||
|
distributed
|
||||||
|
seen
|
||||||
|
files {
|
||||||
|
url
|
||||||
|
name
|
||||||
|
type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
39
backend/src/graphql/queries/Post.ts
Normal file
39
backend/src/graphql/queries/Post.ts
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const Post = gql`
|
||||||
|
query ($id: ID, $filter: _PostFilter, $first: Int, $offset: Int, $orderBy: [_PostOrdering]) {
|
||||||
|
Post(id: $id, filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
eventStart
|
||||||
|
pinned
|
||||||
|
createdAt
|
||||||
|
pinnedAt
|
||||||
|
isObservedByMe
|
||||||
|
observingUsersCount
|
||||||
|
clickedCount
|
||||||
|
emotionsCount
|
||||||
|
emotions {
|
||||||
|
emotion
|
||||||
|
User {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
author {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
shoutedBy {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
tags {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
comments {
|
||||||
|
content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const PostsEmotionsByCurrentUser = gql`
|
||||||
|
query ($postId: ID!) {
|
||||||
|
PostsEmotionsByCurrentUser(postId: $postId)
|
||||||
|
}
|
||||||
|
`
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const PostsEmotionsCountByEmotion = gql`
|
||||||
|
query ($postId: ID!, $data: _EMOTEDInput!) {
|
||||||
|
PostsEmotionsCountByEmotion(postId: $postId, data: $data)
|
||||||
|
}
|
||||||
|
`
|
||||||
15
backend/src/graphql/queries/RemovePostEmotions.ts
Normal file
15
backend/src/graphql/queries/RemovePostEmotions.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const RemovePostEmotions = gql`
|
||||||
|
mutation ($to: _PostInput!, $data: _EMOTEDInput!) {
|
||||||
|
RemovePostEmotions(to: $to, data: $data) {
|
||||||
|
from {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
emotion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
16
backend/src/graphql/queries/RemoveUserFromGroup.ts
Normal file
16
backend/src/graphql/queries/RemoveUserFromGroup.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const RemoveUserFromGroup = gql`
|
||||||
|
mutation ($groupId: ID!, $userId: ID!) {
|
||||||
|
RemoveUserFromGroup(groupId: $groupId, userId: $userId) {
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
membership {
|
||||||
|
role
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
34
backend/src/graphql/queries/Room.ts
Normal file
34
backend/src/graphql/queries/Room.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const Room = gql`
|
||||||
|
query Room($first: Int, $offset: Int, $id: ID) {
|
||||||
|
Room(first: $first, offset: $offset, id: $id, orderBy: lastMessageAt_desc) {
|
||||||
|
id
|
||||||
|
roomId
|
||||||
|
roomName
|
||||||
|
avatar
|
||||||
|
lastMessageAt
|
||||||
|
unreadCount
|
||||||
|
lastMessage {
|
||||||
|
_id
|
||||||
|
id
|
||||||
|
content
|
||||||
|
senderId
|
||||||
|
username
|
||||||
|
avatar
|
||||||
|
date
|
||||||
|
saved
|
||||||
|
distributed
|
||||||
|
seen
|
||||||
|
}
|
||||||
|
users {
|
||||||
|
_id
|
||||||
|
id
|
||||||
|
name
|
||||||
|
avatar {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
9
backend/src/graphql/queries/Signup.ts
Normal file
9
backend/src/graphql/queries/Signup.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const Signup = gql`
|
||||||
|
mutation ($email: String!, $locale: String!, $inviteCode: String) {
|
||||||
|
Signup(email: $email, locale: $locale, inviteCode: $inviteCode) {
|
||||||
|
email
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
30
backend/src/graphql/queries/SignupVerification.ts
Normal file
30
backend/src/graphql/queries/SignupVerification.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const SignupVerification = gql`
|
||||||
|
mutation (
|
||||||
|
$password: String!
|
||||||
|
$email: String!
|
||||||
|
$name: String!
|
||||||
|
$slug: String
|
||||||
|
$nonce: String!
|
||||||
|
$termsAndConditionsAgreedVersion: String!
|
||||||
|
$about: String
|
||||||
|
$locale: String
|
||||||
|
) {
|
||||||
|
SignupVerification(
|
||||||
|
email: $email
|
||||||
|
password: $password
|
||||||
|
name: $name
|
||||||
|
slug: $slug
|
||||||
|
nonce: $nonce
|
||||||
|
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
|
||||||
|
about: $about
|
||||||
|
locale: $locale
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
slug
|
||||||
|
termsAndConditionsAgreedVersion
|
||||||
|
termsAndConditionsAgreedAt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
7
backend/src/graphql/queries/UnreadRooms.ts
Normal file
7
backend/src/graphql/queries/UnreadRooms.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const UnreadRooms = gql`
|
||||||
|
query {
|
||||||
|
UnreadRooms
|
||||||
|
}
|
||||||
|
`
|
||||||
12
backend/src/graphql/queries/UpdateComment.ts
Normal file
12
backend/src/graphql/queries/UpdateComment.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const UpdateComment = gql`
|
||||||
|
mutation ($content: String!, $id: ID!) {
|
||||||
|
UpdateComment(content: $content, id: $id) {
|
||||||
|
id
|
||||||
|
content
|
||||||
|
createdAt
|
||||||
|
updatedAt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
14
backend/src/graphql/queries/UpdateDonations.ts
Normal file
14
backend/src/graphql/queries/UpdateDonations.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const UpdateDonations = gql`
|
||||||
|
mutation ($showDonations: Boolean, $goal: Int, $progress: Int) {
|
||||||
|
UpdateDonations(showDonations: $showDonations, goal: $goal, progress: $progress) {
|
||||||
|
id
|
||||||
|
showDonations
|
||||||
|
goal
|
||||||
|
progress
|
||||||
|
createdAt
|
||||||
|
updatedAt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
54
backend/src/graphql/queries/UpdateGroup.ts
Normal file
54
backend/src/graphql/queries/UpdateGroup.ts
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const UpdateGroup = gql`
|
||||||
|
mutation (
|
||||||
|
$id: ID!
|
||||||
|
$name: String
|
||||||
|
$slug: String
|
||||||
|
$about: String
|
||||||
|
$description: String
|
||||||
|
$actionRadius: GroupActionRadius
|
||||||
|
$categoryIds: [ID]
|
||||||
|
$avatar: ImageInput
|
||||||
|
$locationName: String # empty string '' sets it to null
|
||||||
|
) {
|
||||||
|
UpdateGroup(
|
||||||
|
id: $id
|
||||||
|
name: $name
|
||||||
|
slug: $slug
|
||||||
|
about: $about
|
||||||
|
description: $description
|
||||||
|
actionRadius: $actionRadius
|
||||||
|
categoryIds: $categoryIds
|
||||||
|
avatar: $avatar
|
||||||
|
locationName: $locationName
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
createdAt
|
||||||
|
updatedAt
|
||||||
|
disabled
|
||||||
|
deleted
|
||||||
|
about
|
||||||
|
description
|
||||||
|
descriptionExcerpt
|
||||||
|
groupType
|
||||||
|
actionRadius
|
||||||
|
categories {
|
||||||
|
id
|
||||||
|
slug
|
||||||
|
name
|
||||||
|
icon
|
||||||
|
}
|
||||||
|
# avatar # test this as result
|
||||||
|
locationName
|
||||||
|
location {
|
||||||
|
name
|
||||||
|
nameDE
|
||||||
|
nameEN
|
||||||
|
}
|
||||||
|
myRole
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
44
backend/src/graphql/queries/UpdatePost.ts
Normal file
44
backend/src/graphql/queries/UpdatePost.ts
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const UpdatePost = gql`
|
||||||
|
mutation (
|
||||||
|
$id: ID!
|
||||||
|
$title: String!
|
||||||
|
$content: String!
|
||||||
|
$image: ImageInput
|
||||||
|
$categoryIds: [ID]
|
||||||
|
$postType: PostType
|
||||||
|
$eventInput: _EventInput
|
||||||
|
) {
|
||||||
|
UpdatePost(
|
||||||
|
id: $id
|
||||||
|
title: $title
|
||||||
|
content: $content
|
||||||
|
image: $image
|
||||||
|
categoryIds: $categoryIds
|
||||||
|
postType: $postType
|
||||||
|
eventInput: $eventInput
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
content
|
||||||
|
author {
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
createdAt
|
||||||
|
updatedAt
|
||||||
|
categories {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
postType
|
||||||
|
eventStart
|
||||||
|
eventLocationName
|
||||||
|
eventVenue
|
||||||
|
eventLocation {
|
||||||
|
lng
|
||||||
|
lat
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
10
backend/src/graphql/queries/UpdateSocialMedia.ts
Normal file
10
backend/src/graphql/queries/UpdateSocialMedia.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const UpdateSocialMedia = gql`
|
||||||
|
mutation ($id: ID!, $url: String!) {
|
||||||
|
UpdateSocialMedia(id: $id, url: $url) {
|
||||||
|
id
|
||||||
|
url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
67
backend/src/graphql/queries/UpdateUser.ts
Normal file
67
backend/src/graphql/queries/UpdateUser.ts
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const UpdateUser = gql`
|
||||||
|
mutation (
|
||||||
|
$id: ID!
|
||||||
|
$slug: String
|
||||||
|
$name: String
|
||||||
|
$about: String
|
||||||
|
$allowEmbedIframes: Boolean
|
||||||
|
$showShoutsPublicly: Boolean
|
||||||
|
$emailNotificationSettings: [EmailNotificationSettingsInput]
|
||||||
|
$termsAndConditionsAgreedVersion: String
|
||||||
|
$avatar: ImageInput
|
||||||
|
$locationName: String # empty string '' sets it to null
|
||||||
|
$locale: String
|
||||||
|
) {
|
||||||
|
UpdateUser(
|
||||||
|
id: $id
|
||||||
|
slug: $slug
|
||||||
|
name: $name
|
||||||
|
about: $about
|
||||||
|
allowEmbedIframes: $allowEmbedIframes
|
||||||
|
showShoutsPublicly: $showShoutsPublicly
|
||||||
|
emailNotificationSettings: $emailNotificationSettings
|
||||||
|
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
|
||||||
|
avatar: $avatar
|
||||||
|
locationName: $locationName
|
||||||
|
locale: $locale
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
slug
|
||||||
|
name
|
||||||
|
about
|
||||||
|
allowEmbedIframes
|
||||||
|
showShoutsPublicly
|
||||||
|
termsAndConditionsAgreedVersion
|
||||||
|
termsAndConditionsAgreedAt
|
||||||
|
locationName
|
||||||
|
locale
|
||||||
|
location {
|
||||||
|
name
|
||||||
|
nameDE
|
||||||
|
nameEN
|
||||||
|
nameRU
|
||||||
|
}
|
||||||
|
emailNotificationSettings {
|
||||||
|
type
|
||||||
|
settings {
|
||||||
|
name
|
||||||
|
value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
avatar {
|
||||||
|
url
|
||||||
|
alt
|
||||||
|
sensitive
|
||||||
|
aspectRatio
|
||||||
|
type
|
||||||
|
}
|
||||||
|
badgeVerification {
|
||||||
|
id
|
||||||
|
description
|
||||||
|
icon
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
165
backend/src/graphql/queries/User.ts
Normal file
165
backend/src/graphql/queries/User.ts
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const User = gql`
|
||||||
|
query ($id: ID, $name: String, $email: String) {
|
||||||
|
User(id: $id, name: $name, email: $email) {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
badgeTrophiesCount
|
||||||
|
badgeTrophies {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
badgeVerification {
|
||||||
|
id
|
||||||
|
isDefault
|
||||||
|
}
|
||||||
|
badgeTrophiesSelected {
|
||||||
|
id
|
||||||
|
isDefault
|
||||||
|
}
|
||||||
|
followedBy {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
followedByCurrentUser
|
||||||
|
following {
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
about
|
||||||
|
avatar {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
comments {
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
}
|
||||||
|
contributions {
|
||||||
|
title
|
||||||
|
slug
|
||||||
|
image {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isMuted
|
||||||
|
isBlocked
|
||||||
|
location {
|
||||||
|
distanceToMe
|
||||||
|
}
|
||||||
|
activeCategories
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
export const UserEmailNotificationSettings = gql`
|
||||||
|
query ($id: ID, $name: String, $email: String) {
|
||||||
|
User(id: $id, name: $name, email: $email) {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
badgeTrophiesCount
|
||||||
|
badgeTrophies {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
badgeVerification {
|
||||||
|
id
|
||||||
|
isDefault
|
||||||
|
}
|
||||||
|
badgeTrophiesSelected {
|
||||||
|
id
|
||||||
|
isDefault
|
||||||
|
}
|
||||||
|
followedBy {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
followedByCurrentUser
|
||||||
|
following {
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
about
|
||||||
|
avatar {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
comments {
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
}
|
||||||
|
contributions {
|
||||||
|
title
|
||||||
|
slug
|
||||||
|
image {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isMuted
|
||||||
|
isBlocked
|
||||||
|
location {
|
||||||
|
distanceToMe
|
||||||
|
}
|
||||||
|
emailNotificationSettings {
|
||||||
|
type
|
||||||
|
settings {
|
||||||
|
name
|
||||||
|
value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
activeCategories
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
export const UserEmail = gql`
|
||||||
|
query ($id: ID, $name: String, $email: String) {
|
||||||
|
User(id: $id, name: $name, email: $email) {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
email
|
||||||
|
badgeTrophiesCount
|
||||||
|
badgeTrophies {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
badgeVerification {
|
||||||
|
id
|
||||||
|
isDefault
|
||||||
|
}
|
||||||
|
badgeTrophiesSelected {
|
||||||
|
id
|
||||||
|
isDefault
|
||||||
|
}
|
||||||
|
followedBy {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
followedByCurrentUser
|
||||||
|
following {
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
about
|
||||||
|
avatar {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
comments {
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
}
|
||||||
|
contributions {
|
||||||
|
title
|
||||||
|
slug
|
||||||
|
image {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isMuted
|
||||||
|
isBlocked
|
||||||
|
location {
|
||||||
|
distanceToMe
|
||||||
|
}
|
||||||
|
activeCategories
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
11
backend/src/graphql/queries/VerifyEmailAddress.ts
Normal file
11
backend/src/graphql/queries/VerifyEmailAddress.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const VerifyEmailAddress = gql`
|
||||||
|
mutation ($email: String!, $nonce: String!) {
|
||||||
|
VerifyEmailAddress(email: $email, nonce: $nonce) {
|
||||||
|
email
|
||||||
|
createdAt
|
||||||
|
verifiedAt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
7
backend/src/graphql/queries/VerifyNonce.ts
Normal file
7
backend/src/graphql/queries/VerifyNonce.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const VerifyNonce = gql`
|
||||||
|
query ($email: String!, $nonce: String!) {
|
||||||
|
VerifyNonce(email: $email, nonce: $nonce)
|
||||||
|
}
|
||||||
|
`
|
||||||
@ -1,5 +0,0 @@
|
|||||||
mutation Signup($email: String!, $locale: String!, $inviteCode: String) {
|
|
||||||
Signup(email: $email, locale: $locale, inviteCode: $inviteCode) {
|
|
||||||
email
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
mutation SignupVerification(
|
|
||||||
$password: String!
|
|
||||||
$email: String!
|
|
||||||
$name: String!
|
|
||||||
$slug: String
|
|
||||||
$nonce: String!
|
|
||||||
$termsAndConditionsAgreedVersion: String!
|
|
||||||
$about: String
|
|
||||||
$locale: String
|
|
||||||
) {
|
|
||||||
SignupVerification(
|
|
||||||
email: $email
|
|
||||||
password: $password
|
|
||||||
name: $name
|
|
||||||
slug: $slug
|
|
||||||
nonce: $nonce
|
|
||||||
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
|
|
||||||
about: $about
|
|
||||||
locale: $locale
|
|
||||||
) {
|
|
||||||
id
|
|
||||||
slug
|
|
||||||
termsAndConditionsAgreedVersion
|
|
||||||
termsAndConditionsAgreedAt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user