diff --git a/.cdk/config.ts b/.cdk/config.ts index 1d759726dd..10b662c4da 100644 --- a/.cdk/config.ts +++ b/.cdk/config.ts @@ -41,11 +41,6 @@ export const apps: { [key: string]: { stg?: Options; prd?: Options } } = { sslCert: sunnyCert } }, - scoutgameadmin: { - prd: { - sslCert: scoutgameCert - } - }, scoutgame: { prd: { sslCert: scoutgameCert diff --git a/.ebextensions/scoutgameadmin/00_env_vars.config b/.ebextensions/scoutgameadmin/00_env_vars.config deleted file mode 100644 index c19a70f988..0000000000 --- a/.ebextensions/scoutgameadmin/00_env_vars.config +++ /dev/null @@ -1,14 +0,0 @@ -# Do not put any env var or secrets used by the app here. Put in .ebstalk.apps.env/scoutgame.env -# This file should only have -# - env variables referenced in docker-compose file -# - variables needed for the .platform/hooks/predeploy/01_pull_secrets.sh script to run - -option_settings: - aws:elasticbeanstalk:application:environment: - COMPOSE_PROJECT_NAME: "prd" - COMPOSE_PROFILES: "prd-scoutgameadmin" - EBSTALK_ENV_FILE: "scoutgameadmin.env" - SERVICE_ENV: "prd" # this sets the value of datadog env tag - SERVICE_NAME: "scoutgameadmin" - IMGNAME: "scoutgameadmin" - IMGTAG: "" diff --git a/.ebextensions/scoutgameadmin/01_filesystem.config b/.ebextensions/scoutgameadmin/01_filesystem.config deleted file mode 100644 index 4949bef643..0000000000 --- a/.ebextensions/scoutgameadmin/01_filesystem.config +++ /dev/null @@ -1,4 +0,0 @@ -option_settings: - aws:autoscaling:launchconfiguration: - RootVolumeType: gp2 - RootVolumeSize: "24" diff --git a/.ebextensions/scoutgameadmin/02_autoscaling.config b/.ebextensions/scoutgameadmin/02_autoscaling.config deleted file mode 100644 index 426d0643f5..0000000000 --- a/.ebextensions/scoutgameadmin/02_autoscaling.config +++ /dev/null @@ -1,7 +0,0 @@ -# this configures Beanstalk to restart the app if the app's health check fails -Resources: - AWSEBAutoScalingGroup: - Type: "AWS::AutoScaling::AutoScalingGroup" - Properties: - HealthCheckType: ELB - HealthCheckGracePeriod: 300 \ No newline at end of file diff --git a/.ebextensions/scoutgameadmin/03_env_health_ignore_400.config b/.ebextensions/scoutgameadmin/03_env_health_ignore_400.config deleted file mode 100644 index 3bca1866a8..0000000000 --- a/.ebextensions/scoutgameadmin/03_env_health_ignore_400.config +++ /dev/null @@ -1,13 +0,0 @@ -option_settings: - aws:elasticbeanstalk:healthreporting:system: - SystemType: enhanced - ConfigDocument: - Rules: - Environment: - Application: - ApplicationRequests4xx: - Enabled: false - ELB: - ELBRequests4xx: - Enabled: false - Version: 1 \ No newline at end of file diff --git a/.ebextensions/scoutgameadmin/06_cloudwatch_alarm.config b/.ebextensions/scoutgameadmin/06_cloudwatch_alarm.config deleted file mode 100644 index a8a41b011f..0000000000 --- a/.ebextensions/scoutgameadmin/06_cloudwatch_alarm.config +++ /dev/null @@ -1,21 +0,0 @@ -# Adding alarm for degraded state -Resources: - EnvHealthAlarm: - Type: "AWS::CloudWatch::Alarm" - Properties: - AlarmDescription: "A CloudWatch Alarm that triggers when an Elastic Beanstalk Environment is unhealthy." - Namespace: "AWS/ElasticBeanstalk" - MetricName: "EnvironmentHealth" - Dimensions: - - Name: EnvironmentName - Value: { "Ref" : "AWSEBEnvironmentName" } - Statistic: "Average" - Period: "300" - EvaluationPeriods: "2" - Threshold: "19" # a value between 15 and 20. 15 is warning, 20 is degraded - ComparisonOperator: "GreaterThanOrEqualToThreshold" - AlarmActions: - - "arn:aws:sns:us-east-1:310849459438:Production-Alerts" - OKActions: - - "arn:aws:sns:us-east-1:310849459438:Production-Alerts" - TreatMissingData: "notBreaching" \ No newline at end of file diff --git a/.ebextensions/scoutgameadmin/07_http-to-https.config b/.ebextensions/scoutgameadmin/07_http-to-https.config deleted file mode 100644 index 97a78c9c3d..0000000000 --- a/.ebextensions/scoutgameadmin/07_http-to-https.config +++ /dev/null @@ -1,42 +0,0 @@ -# source: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https-httpredirect.html - -################################################################################################### -#### Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. -#### -#### Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file -#### except in compliance with the License. A copy of the License is located at -#### -#### http://aws.amazon.com/apache2.0/ -#### -#### or in the "license" file accompanying this file. This file is distributed on an "AS IS" -#### BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -#### License for the specific language governing permissions and limitations under the License. -################################################################################################### - -################################################################################################### -#### This configuration file modifies the default port 80 listener attached to an Application Load Balancer -#### to automatically redirect incoming connections on HTTP to HTTPS. -#### This will not work with an environment using the load balancer type Classic or Network. -#### A prerequisite is that the 443 listener has already been created. -#### Please use the below link for more information about creating an Application Load Balancer on -#### the Elastic Beanstalk console. -#### https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-cfg-alb.html#environments-cfg-alb-console -################################################################################################### - -Resources: - AWSEBV2LoadBalancerListener: - Type: AWS::ElasticLoadBalancingV2::Listener - Properties: - LoadBalancerArn: - Ref: AWSEBV2LoadBalancer - Port: 80 - Protocol: HTTP - DefaultActions: - - Type: redirect - RedirectConfig: - Host: "#{host}" - Path: "/#{path}" - Port: "443" - Protocol: "HTTPS" - Query: "#{query}" - StatusCode: "HTTP_301" \ No newline at end of file diff --git a/.ebstalk.apps.env/scoutgameadmin.env b/.ebstalk.apps.env/scoutgameadmin.env deleted file mode 100644 index 8bbb4c828b..0000000000 --- a/.ebstalk.apps.env/scoutgameadmin.env +++ /dev/null @@ -1,34 +0,0 @@ -DOMAIN="https://admin.scoutgame.xyz" -REACT_APP_APP_ENV="production" -NODE_ENV="production" -DATABASE_URL="{{pull:secretsmanager:/io.cv.app/prd/db:SecretString:database_url}}" -AUTH_COOKIE="scoutadmin-session" -AUTH_SECRET="{{pull:secretsmanager:/io.cv.app/prd/auth_secret:SecretString:auth_secret}}" -# apis -GITHUB_ACCESS_TOKEN="{{pull:secretsmanager:/io.cv.app/prd/github:SecretString:scoutgame_github_access_token}}" -NEYNAR_API_KEY="{{pull:secretsmanager:/io.cv.app/prd/neynar:SecretString:neynar_api_key}}" -REACT_APP_DECENT_API_KEY="{{pull:secretsmanager:/io.cv.app/prd/decent:SecretString:decent_api_key}}" -ALCHEMY_API_KEY="{{pull:secretsmanager:/io.cv.app/prd/alchemy:SecretString:alchemy_api_key}}" -AIRSTACK_API_KEY="{{pull:secretsmanager:/io.cv.app/prd/farcaster:SecretString:airstack_api_key}}" -TALENT_PROTOCOL_API_KEY="{{pull:secretsmanager:/io.cv.app/prd/talent:SecretString:api_key}}" -WARPCAST_API_KEY="{{pull:secretsmanager:/io.cv.app/prd/farcaster:SecretString:warpcast_api_key_chris}}" - -REACT_APP_BUILDER_NFT_CONTRACT_ADDRESS="{{pull:secretsmanager:/io.cv.app/prd/buildernft:SecretString:builder_smart_contract_address}}" - -BUILDER_SMART_CONTRACT_MINTER_PRIVKEY="{{pull:secretsmanager:/io.cv.app/prd/buildernft:SecretString:builder_smart_contract_minter_privkey}}" - -SCOUTGAME_CONTRACT_NAME="prd" -SCOUTGAME_S3_BUCKET="scoutgame.public" -S3_UPLOAD_REGION="{{pull:secretsmanager:/io.cv.app/prd/aws/s3:SecretString:region}}" -S3_UPLOAD_SECRET="{{pull:secretsmanager:/io.cv.app/prd/aws/s3:SecretString:access_key_secret}}" -S3_UPLOAD_KEY="{{pull:secretsmanager:/io.cv.app/prd/aws/s3:SecretString:access_key}}" - -# Scout protocol season 2 -SCOUTGAME_METADATA_PATH_PREFIX="prd" -REACT_APP_SCOUTPROTOCOL_CONTRACT_ADDRESS="{{pull:secretsmanager:/io.cv.app/prd/buildernft:SecretString:scoutprotocol_contract_address}}" -SCOUTPROTOCOL_CLAIMS_MANAGER_PRIVKEY="{{pull:secretsmanager:/io.cv.app/prd/buildernft:SecretString:scoutprotocol_claims_manager_privkey}}" -SCOUTPROTOCOL_EAS_ATTESTER_PRIVKEY="{{pull:secretsmanager:/io.cv.app/prd/buildernft:SecretString:scoutprotocol_eas_attester_privkey}}" - -# Attestation schemas -REACT_APP_SCOUTPROTOCOL_PROFILE_EAS_SCHEMAID="{{pull:secretsmanager:/io.cv.app/prd/buildernft:SecretString:scoutprotocol_profile_eas_schemaid}}" -REACT_APP_SCOUTPROTOCOL_CONTRIBUTION_RECEIPT_EAS_SCHEMAID="{{pull:secretsmanager:/io.cv.app/prd/buildernft:SecretString:scoutprotocol_contribution_receipt_eas_schemaid}}" diff --git a/.eslintrc.json b/.eslintrc.json index 6a6f372712..ac59e71034 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -83,7 +83,6 @@ "./apps/farcaster/", "./apps/scoutgame/", "./apps/scoutgametelegram/", - "./apps/scoutgameadmin/", "./apps/scoutgamecron/", "./apps/sunnyawards/", "./apps/waitlist/", @@ -208,4 +207,4 @@ } } ] -} \ No newline at end of file +} diff --git a/.github/actions/build_docker_image/action.yml b/.github/actions/build_docker_image/action.yml index e88d9d66af..370816c7b2 100644 --- a/.github/actions/build_docker_image/action.yml +++ b/.github/actions/build_docker_image/action.yml @@ -36,7 +36,6 @@ runs: rm -rf apps/sunnyawards/.next/cache rm -rf apps/farcaster/.next/cache rm -rf apps/scoutgametelegram/.next/cache - rm -rf apps/scoutgameadmin/.next/cache - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/.github/workflows/deploy_scoutgameadmin.yml b/.github/workflows/deploy_scoutgameadmin.yml deleted file mode 100644 index e7d8ccf2a6..0000000000 --- a/.github/workflows/deploy_scoutgameadmin.yml +++ /dev/null @@ -1,278 +0,0 @@ -name: Scoutgame Scout Game Admin CI - -on: - push: - branches: [main] - paths: - - '.cdk/**' - - 'docker-compose.yml' - - '.ebextensions/scoutgameadmin/**' - - '.ebstalk.apps.env/scoutgameadmin.env' - - '.github/actions/**' - - '.github/workflows/deploy_scoutgameadmin.yml' - - 'package.json' - - 'package-lock.json' - - 'apps/scoutgameadmin/**' - - 'packages/**' - pull_request: - types: [labeled, opened, synchronize] - branches: ['**'] - paths: - - '.cdk/**' - - 'docker-compose.yml' - - '.ebextensions/scoutgameadmin/**' - - '.ebstalk.apps.env/scoutgameadmin.env' - - '.github/actions/**' - - '.github/workflows/deploy_scoutgameadmin.yml' - - 'package.json' - - 'package-lock.json' - - 'apps/scoutgameadmin/**' - - 'packages/**' - workflow_dispatch: - inputs: - core_pkg_version: - description: 'Core pkg version to update to' - required: true - -concurrency: - group: ci-scoutgameadmin-${{ github.event_name }}-${{ github.ref }} - -jobs: - build: - name: Build Scout Game Admin - runs-on: ubuntu-latest - outputs: - head_commit_message: ${{ steps.setup_variables.outputs.commit_message }} - deploy_staging: ${{ steps.setup_variables.outputs.deploy_staging }} - skip_tests: ${{ steps.setup_variables.outputs.skip_tests }} - steps: - - name: Print Triggering event context payload - env: - workflow_event_context: ${{ toJSON(github.event) }} - run: | - echo "$workflow_event_context" - echo "Workflow and code ref: ${{github.ref}}" - - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup variables - id: setup_variables - # source https://github.com/orgs/community/discussions/28474 - run: | - echo "commit_message=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" - echo "deploy_staging=${{(github.event.action == 'labeled' && github.event.label.name == ':rocket: deploy-scoutgameadmin') || (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, ':rocket: deploy-scoutgameadmin'))}}" >> $GITHUB_OUTPUT - echo "skip_tests=${{ contains(env.commit_message, 'skip-tests') }}" >> $GITHUB_OUTPUT - - - name: Install dependencies - uses: ./.github/actions/install - with: - core_pkg_version: ${{ inputs.core_pkg_version }} - commit_core_pkg_upgrade: true - - - name: Build app - uses: ./.github/actions/build_app - with: - app_name: scoutgameadmin - - test-scoutgameadmin: - name: Test apps - runs-on: ubuntu-latest - needs: build - if: ${{ github.event.action != 'labeled' && needs.build.outputs.skip_tests != 'true' }} - # Postgres setup copied from https://gist.github.com/2color/537f8ef13ecec80059abb007839a6878 - services: - postgres: - image: postgres - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - --hostname postgres - ports: - # Maps tcp port 5432 on service container to the host - - 5432:5432 - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Restore dependencies from cache - uses: ./.github/actions/install - - - name: Setup test database - run: npx dotenv -e .env.test.local -- npm run prisma:reset - - - name: Restore app from cache - uses: ./.github/actions/build_app - with: - app_name: scoutgameadmin - - - name: Typecheck app - run: npm run typecheck -w apps/scoutgameadmin - - - name: Run app tests - run: npm run scoutgameadmin:test - - upload-docker: - name: Upload Docker image - runs-on: ubuntu-latest - # run whether previous jobs were successful or skipped - if: | - github.ref == 'refs/heads/main' || needs.build.outputs.deploy_staging == 'true' - needs: build - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install dependencies - uses: ./.github/actions/install - - - name: Restore app from cache - uses: ./.github/actions/build_app - with: - app_name: scoutgameadmin - - - name: Update Dockerfile - run: | - rm Dockerfile && mv apps/scoutgameadmin/Dockerfile Dockerfile - - - name: Build and Push Docker image - id: docker_build_push - uses: ./.github/actions/build_docker_image - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: us-east-1 - with: - ecr_registry: scoutgameadmin - - upload-static-assets: - name: Upload assets in production - runs-on: ubuntu-latest - # run whether previous jobs were successful or skipped - if: github.ref == 'refs/heads/main' && !(failure() || cancelled()) - needs: build - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install dependencies - uses: ./.github/actions/install - with: - app_name: scoutgameadmin - - - name: Calculate Build ID - id: get_build_id - run: | - build_id=${{ hashFiles('package-lock.json', 'apps/**/*.[jt]s', 'lib/**/*.[jt]s') }} - echo "build_id=$build_id" >> $GITHUB_OUTPUT - - - name: Restore app from cache - uses: ./.github/actions/build_app - with: - app_name: scoutgameadmin - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - deploy-production: - name: Deploy to production - # run whether previous jobs were successful or skipped - if: github.ref == 'refs/heads/main' && !(failure() || cancelled()) - needs: [test-scoutgameadmin, upload-docker, upload-static-assets] - runs-on: ubuntu-latest - strategy: - matrix: - include: - - stack: prd-scoutgameadmin - ebextensions: scoutgameadmin - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Inject slug/short variables - uses: rlespinasse/github-slug-action@v4.x - with: - short-length: 7 - - # we need to bring back node_modules which includes tsconfig-paths which is used by CDK files - - name: Install dependencies - uses: ./.github/actions/install - with: - app_name: scoutgameadmin - - - name: Set the docker compose env variables - uses: mikefarah/yq@master - with: - cmd: | - mv .ebextensions .ebextensions_tmp && mv .ebextensions_tmp/${{ matrix.ebextensions }} .ebextensions - yq -I 4 -i ' - with(.option_settings."aws:elasticbeanstalk:application:environment"; - .IMGTAG = "${{ github.run_id }}-${{ env.GITHUB_SHA_SHORT }}") - ' .ebextensions/00_env_vars.config - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - - name: Package and deploy - run: | - cat files_to_zip.txt | zip --symlinks -r@ ${{ matrix.stack }}.zip - npx aws-cdk deploy --method=direct -c name=${{ matrix.stack }} - - deploy-staging: - name: Deploy to staging - - if: needs.build.outputs.deploy_staging == 'true' - runs-on: ubuntu-latest - # prevent staging deploys + cleanup running in parallel - concurrency: staging-${{ github.ref }} - needs: [build, upload-docker] - steps: - - uses: actions/checkout@v4 - - - uses: ./.github/actions/deploy_staging - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - app_name: scoutgameadmin - - discord-alert: - name: Notify Discord of failure - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' && failure() - # pass in all steps so we can check if any failed - needs: [test-scoutgameadmin, upload-docker, upload-static-assets, upload-docker, deploy-production] - steps: - - name: If any of prev jobs failed notify discord - if: contains(needs.*.result, 'failure') - uses: sarisia/actions-status-discord@v1 - with: - webhook: ${{ secrets.DISCORD_WARNINGS_WEBHOOK }} - status: 'failure' - content: 'Hey <@&1027309276454207519>' - title: 'Scout Game Admin deploy workflow failed' - description: | - Failed workflow URL: https://github.com/charmverse/app.charmverse.io/actions/runs/${{ github.run_id }} - color: '16515843' - url: 'https://github.com/charmverse/app.charmverse.io/actions/runs/${{ github.run_id }}' - username: GitHub Actions - avatar_url: 'https://github.githubassets.com/images/modules/logos_page/Octocat.png' diff --git a/.github/workflows/destroy_staging.yml b/.github/workflows/destroy_staging.yml index a0cff91f7b..ffdb8d8a10 100644 --- a/.github/workflows/destroy_staging.yml +++ b/.github/workflows/destroy_staging.yml @@ -11,7 +11,7 @@ jobs: clean-up: if: | (github.event.action == 'unlabeled' && startsWith(github.event.label.name, ':rocket: deploy')) || - (github.event.action == 'closed' && (contains(github.event.pull_request.labels.*.name, ':rocket: deploy') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-ceramic') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-scoutgame') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-sunnyawards') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-scoutgameadmin') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-farcaster') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-cron') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-waitlist') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-websockets') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-scoutgamecron'))) + (github.event.action == 'closed' && (contains(github.event.pull_request.labels.*.name, ':rocket: deploy') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-ceramic') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-scoutgame') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-sunnyawards') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-farcaster') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-cron') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-waitlist') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-websockets') || contains(github.event.pull_request.labels.*.name, ':rocket: deploy-scoutgamecron'))) runs-on: ubuntu-latest steps: - name: Configure AWS credentials @@ -47,7 +47,7 @@ jobs: run: | stage_name_suffix="${{ github.event.number }}-${{ env.GITHUB_HEAD_REF_SLUG }}" - for app in ceramic scoutgameadmin cron farcaster scoutgame scoutgamecron scoutgametelegram sunnyawards waitlist webapp websockets; do + for app in ceramic cron farcaster scoutgame scoutgamecron scoutgametelegram sunnyawards waitlist webapp websockets; do # sanitize and trim string so that it can be used as a valid subdomain. Includes removing hyphens at the start and end of the name stage_name=`echo "stg-${app}-${stage_name_suffix}" | sed -E -e 's/[^a-zA-Z0-9-]+//g' -e 's/(.{40}).*/\1/' -e 's/^-/0/' -e 's/-$/0/'` @@ -87,12 +87,6 @@ jobs: token: ${{ steps.get-token.outputs.token }} environment: ${{ steps.destroy_aws_stack.outputs.scoutgamecron_env }} - - name: Delete Scout Game Admin Github deployment - uses: strumwolf/delete-deployment-environment@v3 - with: - token: ${{ steps.get-token.outputs.token }} - environment: ${{ steps.destroy_aws_stack.outputs.scoutgameadmin_env }} - - name: Delete Scout Game Telegram Github deployment uses: strumwolf/delete-deployment-environment@v3 with: diff --git a/apps/scoutgameadmin/Dockerfile b/apps/scoutgameadmin/Dockerfile deleted file mode 100644 index 80609e5b88..0000000000 --- a/apps/scoutgameadmin/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -#syntax=docker/dockerfile:1.7-labs - -# Use node-slim because node-alpine does not seem to supports the `sharp` npm library that gets built -FROM node:18.19.0-slim AS base-app - -# useful for node-alpine -# RUN apk add --no-cache libc6-compat git -RUN apt update -RUN apt install openssl -y - -WORKDIR /app - -# Copy dependencies -COPY --parents @connect-shared \ - apps/*/package.json \ - packages/*/package.json \ - node_modules \ - package.json \ - apps/scoutgameadmin/node_modules \ - apps/scoutgameadmin/package.json \ - . - -# Copy compiled code -COPY --parents apps/*/.next apps/*/public . - -ENV PORT=3000 - -# Next.js collects completely anonymous telemetry data about general usage. -# Learn more here: https://nextjs.org/telemetry -# Uncomment the following line in case you want to disable telemetry. -ENV NEXT_TELEMETRY_DISABLED=1 -ENV LOG_LEVEL=debug - -EXPOSE 3000 -# need something to keep docker container running until docker-compose runs its command -CMD ["tail", "-f", "/dev/null"] diff --git a/apps/scoutgameadmin/README.md b/apps/scoutgameadmin/README.md deleted file mode 100644 index 835b2f0ac7..0000000000 --- a/apps/scoutgameadmin/README.md +++ /dev/null @@ -1 +0,0 @@ -# connect.charmverse.io Coming Soon diff --git a/apps/scoutgameadmin/app/(general)/contract/page.tsx b/apps/scoutgameadmin/app/(general)/contract/page.tsx deleted file mode 100644 index ea97eba49f..0000000000 --- a/apps/scoutgameadmin/app/(general)/contract/page.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { ContractDashboard } from 'components/contract/ContractDashboard'; -import { aggregateProtocolData } from 'lib/contract/aggregateProtocolData'; -import { getContractData } from 'lib/contract/getContractData'; -import { getUserFromSession } from 'lib/session/getUserFromSession'; - -export const dynamic = 'force-dynamic'; - -export default async function Dashboard({ - searchParams -}: { - searchParams: { [key: string]: string | string[] | undefined }; -}) { - const tab = searchParams.tab as string; - const seasonOneData = await getContractData(); - return ; -} diff --git a/apps/scoutgameadmin/app/(general)/farcaster/page.tsx b/apps/scoutgameadmin/app/(general)/farcaster/page.tsx deleted file mode 100644 index 7469799fae..0000000000 --- a/apps/scoutgameadmin/app/(general)/farcaster/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { FarcasterDashboard } from 'components/farcaster/FarcasterDashboard'; -import { getUserFromSession } from 'lib/session/getUserFromSession'; - -export const dynamic = 'force-dynamic'; - -export default async function DashboardPage() { - const user = await getUserFromSession(); - return ; -} diff --git a/apps/scoutgameadmin/app/(general)/layout.tsx b/apps/scoutgameadmin/app/(general)/layout.tsx deleted file mode 100644 index 717a82cd0c..0000000000 --- a/apps/scoutgameadmin/app/(general)/layout.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { Box } from '@mui/material'; -import type { ReactNode } from 'react'; - -import { Header } from 'components/common/Header'; -import { StickyFooter } from 'components/common/StickyFooter'; -import { getUserFromSession } from 'lib/session/getUserFromSession'; - -export default async function Layout({ - children -}: Readonly<{ - children: ReactNode; -}>) { - const user = await getUserFromSession(); - - return ( - -
- - {children} - - - - ); -} diff --git a/apps/scoutgameadmin/app/(general)/repos/page.tsx b/apps/scoutgameadmin/app/(general)/repos/page.tsx deleted file mode 100644 index 640d04610b..0000000000 --- a/apps/scoutgameadmin/app/(general)/repos/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { ReposDashboard } from 'components/repos/ReposDashboard'; -import { getRepos } from 'lib/repos/getRepos'; - -export const dynamic = 'force-dynamic'; - -export default async function Dashboard() { - const repos = await getRepos(); - return ; -} diff --git a/apps/scoutgameadmin/app/(general)/template.tsx b/apps/scoutgameadmin/app/(general)/template.tsx deleted file mode 100644 index f8b52b4fe4..0000000000 --- a/apps/scoutgameadmin/app/(general)/template.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { Box } from '@mui/material'; -import type { ReactNode } from 'react'; - -export default function Template({ children }: { children: ReactNode }) { - return {children}; -} diff --git a/apps/scoutgameadmin/app/(general)/users/page.tsx b/apps/scoutgameadmin/app/(general)/users/page.tsx deleted file mode 100644 index 049605e638..0000000000 --- a/apps/scoutgameadmin/app/(general)/users/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { UsersDashboard } from 'components/users/UsersDashboard'; -import { getUsers } from 'lib/users/getUsers'; - -export const dynamic = 'force-dynamic'; - -export default async function Dashboard() { - const users = await getUsers(); - return ; -} diff --git a/apps/scoutgameadmin/app/(info)/layout.tsx b/apps/scoutgameadmin/app/(info)/layout.tsx deleted file mode 100644 index aac2da63a7..0000000000 --- a/apps/scoutgameadmin/app/(info)/layout.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Box } from '@mui/material'; -import type { ReactNode } from 'react'; - -import 'theme/styles.scss'; - -export default function Layout({ - children -}: Readonly<{ - children: ReactNode; -}>) { - return ( - - - {children} - - - ); -} diff --git a/apps/scoutgameadmin/app/(info)/login/page.tsx b/apps/scoutgameadmin/app/(info)/login/page.tsx deleted file mode 100644 index bc8af047e4..0000000000 --- a/apps/scoutgameadmin/app/(info)/login/page.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import type { Metadata } from 'next'; - -import { LoginPage as LoginPageComponent } from 'components/login/LoginPage'; - -export const metadata: Metadata = { - title: 'Login to Scout Game Admin' -}; - -export default async function LoginPage() { - return ; -} diff --git a/apps/scoutgameadmin/app/(info)/template.tsx b/apps/scoutgameadmin/app/(info)/template.tsx deleted file mode 100644 index 0693c1773d..0000000000 --- a/apps/scoutgameadmin/app/(info)/template.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { Box } from '@mui/material'; -import type { ReactNode } from 'react'; - -export default function Template({ children }: { children: ReactNode }) { - return {children}; -} diff --git a/apps/scoutgameadmin/app/api/blockchain/scout-events/route.ts b/apps/scoutgameadmin/app/api/blockchain/scout-events/route.ts deleted file mode 100644 index 3ae09b8fd6..0000000000 --- a/apps/scoutgameadmin/app/api/blockchain/scout-events/route.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { getOnchainPurchaseEvents } from '@packages/scoutgame/builderNfts/getOnchainPurchaseEvents'; -import type { NextRequest } from 'next/server'; -import { NextResponse } from 'next/server'; - -export type RequestParams = { - chainId: string; - txHash: string; -}; - -export async function GET(request: NextRequest) { - const { searchParams } = new URL(request.url); - const scoutId = searchParams.get('scoutId'); - if (!scoutId) { - return NextResponse.json({ message: 'Missing scoutId' }, { status: 400 }); - } - const userPurchases = await getOnchainPurchaseEvents({ scoutId }); - return NextResponse.json(userPurchases); -} diff --git a/apps/scoutgameadmin/app/api/blockchain/transaction-status/route.ts b/apps/scoutgameadmin/app/api/blockchain/transaction-status/route.ts deleted file mode 100644 index 6277152e2b..0000000000 --- a/apps/scoutgameadmin/app/api/blockchain/transaction-status/route.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { getTransactionStatusFromDecent } from '@packages/blockchain/waitForDecentTransactionSettlement'; -import type { NextRequest } from 'next/server'; -import { NextResponse } from 'next/server'; - -export type RequestParams = { - chainId: string; - txHash: string; -}; - -export async function GET(request: NextRequest) { - const { searchParams } = new URL(request.url); - const chainId = searchParams.get('chainId'); - const txHash = searchParams.get('txHash'); - if (!chainId || !txHash) { - return NextResponse.json({ message: 'Missing chainId or txHash' }, { status: 400 }); - } - const status = await getTransactionStatusFromDecent({ - sourceTxHash: txHash, - sourceTxHashChainId: Number(chainId) - }); - return NextResponse.json(status); -} diff --git a/apps/scoutgameadmin/app/api/github/delete-strike/route.ts b/apps/scoutgameadmin/app/api/github/delete-strike/route.ts deleted file mode 100644 index ead2df1093..0000000000 --- a/apps/scoutgameadmin/app/api/github/delete-strike/route.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { log } from '@charmverse/core/log'; -import { prisma } from '@charmverse/core/prisma-client'; -import type { NextRequest } from 'next/server'; - -export async function DELETE(request: NextRequest) { - const { searchParams } = new URL(request.url); - const strikeId = searchParams.get('strikeId'); - if (!strikeId) { - return Response.json({ error: 'Strike ID is required' }, { status: 400 }); - } - // Delete the strike - const strike = await prisma.builderStrike.update({ - where: { - id: strikeId - }, - data: { - deletedAt: new Date() - } - }); - - log.info('Builder strike marked as deleted', { builderId: strike.builderId, strikeId }); - - return Response.json({ success: true }); -} diff --git a/apps/scoutgameadmin/app/api/github/search-repos/route.ts b/apps/scoutgameadmin/app/api/github/search-repos/route.ts deleted file mode 100644 index 5c4765468e..0000000000 --- a/apps/scoutgameadmin/app/api/github/search-repos/route.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { prisma } from '@charmverse/core/prisma-client'; -import { getReposByOwner } from '@packages/github/getReposByOwner'; -import type { NextRequest } from 'next/server'; -import { NextResponse } from 'next/server'; - -export type RepoSearchResult = { - id: number; - url: string; - fullName: string; - exists: boolean; -}; - -export async function GET(request: NextRequest) { - const { searchParams } = new URL(request.url); - const owner = searchParams.get('owner'); - if (!owner || owner.length < 2) { - return NextResponse.json([]); - } - try { - const repos = await getReposByOwner(owner); - const existing = await prisma.githubRepo.findMany({ - where: { - id: { - in: repos.map((repo) => repo.id) - } - } - }); - const result: RepoSearchResult[] = repos.map((repo) => ({ - id: repo.id, - fullName: repo.full_name, - url: repo.html_url, - exists: existing.some((e) => e.id === repo.id) - })); - return NextResponse.json(result); - } catch (error) { - if ((error as Error).message?.includes('HTTP error! status: 404')) { - return NextResponse.json({ message: 'Repository owner not found' }, { status: 404 }); - } - return NextResponse.json({ message: (error as Error).message || 'Something went wrong' }, { status: 500 }); - } -} diff --git a/apps/scoutgameadmin/app/api/github/user-stats/route.ts b/apps/scoutgameadmin/app/api/github/user-stats/route.ts deleted file mode 100644 index b0e87e0a14..0000000000 --- a/apps/scoutgameadmin/app/api/github/user-stats/route.ts +++ /dev/null @@ -1,82 +0,0 @@ -import type { BuilderStrike, GithubEvent } from '@charmverse/core/prisma-client'; -import { prisma } from '@charmverse/core/prisma-client'; -import { getCommitsByUser } from '@packages/github/getCommitsByUser'; -import { DateTime } from 'luxon'; -import type { NextRequest } from 'next/server'; -import { NextResponse } from 'next/server'; - -type Commit = { - url: string; - date: string; - repo: string; - title: string; -}; - -export type GithubUserStats = { - afterDate: string; - commits: number; - builderStrikes: (Pick & { - githubEvent: GithubEvent & { repo: { owner: string; name: string } }; - })[]; - lastCommit?: Commit; -}; - -const afterDate = DateTime.utc().minus({ months: 3 }).toJSDate(); - -export async function GET(request: NextRequest) { - const { searchParams } = new URL(request.url); - const login = searchParams.get('login'); - if (!login || login.length < 2) { - return NextResponse.json({ commits: 0, builderStrikes: [] }); - } - try { - const builderStrikes = await prisma.builderStrike.findMany({ - where: { - builder: { - githubUser: { - some: { - login - } - } - } - }, - orderBy: { - createdAt: 'desc' - }, - select: { - id: true, - createdAt: true, - deletedAt: true, - githubEvent: { - include: { - repo: true - } - } - } - }); - const commits = await getCommitsByUser({ login, after: afterDate }); - const lastCommit = commits[0]; - const result: GithubUserStats = { - afterDate: afterDate.toISOString(), - commits: commits.length, - builderStrikes: builderStrikes.map((strike) => ({ - ...strike, - githubEvent: strike.githubEvent! // TODO: make this required in the db? - })), - lastCommit: lastCommit - ? { - url: lastCommit.html_url, - title: lastCommit.commit.message, - date: lastCommit.commit.author.date, - repo: lastCommit.repository.full_name - } - : undefined - }; - return NextResponse.json(result); - } catch (error) { - if ((error as Error).message?.includes('HTTP error! status: 404')) { - return NextResponse.json({ message: 'User not found' }, { status: 404 }); - } - return NextResponse.json({ message: (error as Error).message || 'Something went wrong' }, { status: 500 }); - } -} diff --git a/apps/scoutgameadmin/app/api/health/route.ts b/apps/scoutgameadmin/app/api/health/route.ts deleted file mode 100644 index 900a4d5649..0000000000 --- a/apps/scoutgameadmin/app/api/health/route.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function GET() { - return new Response('ok'); -} diff --git a/apps/scoutgameadmin/app/api/partners/celo/route.ts b/apps/scoutgameadmin/app/api/partners/celo/route.ts deleted file mode 100644 index 44852d4aab..0000000000 --- a/apps/scoutgameadmin/app/api/partners/celo/route.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { getLastWeek } from '@packages/scoutgame/dates'; - -import { respondWithTSV } from 'lib/nextjs/respondWithTSV'; -import { getBuildersForPartner } from 'lib/partners/getBuildersForPartner'; - -export const dynamic = 'force-dynamic'; - -export async function GET() { - const lastWeek = getLastWeek(); - const rows = await getBuildersForPartner({ - week: lastWeek, - bonusPartner: 'celo' - }); - - return respondWithTSV(rows, `partners-export_celo_${lastWeek}.tsv`); -} diff --git a/apps/scoutgameadmin/app/api/partners/game7/route.ts b/apps/scoutgameadmin/app/api/partners/game7/route.ts deleted file mode 100644 index 0d0cc46477..0000000000 --- a/apps/scoutgameadmin/app/api/partners/game7/route.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { getLastWeek } from '@packages/scoutgame/dates'; - -import { respondWithTSV } from 'lib/nextjs/respondWithTSV'; -import { getBuildersForPartner } from 'lib/partners/getBuildersForPartner'; - -export const dynamic = 'force-dynamic'; - -export async function GET() { - const lastWeek = getLastWeek(); - const rows = await getBuildersForPartner({ - week: lastWeek, - bonusPartner: 'game7' - }); - return respondWithTSV(rows, `partners-export_game7_${lastWeek}.tsv`); -} diff --git a/apps/scoutgameadmin/app/api/partners/lit_protocol/route.ts b/apps/scoutgameadmin/app/api/partners/lit_protocol/route.ts deleted file mode 100644 index d13cc49545..0000000000 --- a/apps/scoutgameadmin/app/api/partners/lit_protocol/route.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { getLastWeek } from '@packages/scoutgame/dates'; - -import { respondWithTSV } from 'lib/nextjs/respondWithTSV'; -import { getBuildersForPartner } from 'lib/partners/getBuildersForPartner'; - -export const dynamic = 'force-dynamic'; - -export async function GET() { - const lastWeek = getLastWeek(); - const rows = await getBuildersForPartner({ - week: lastWeek, - bonusPartner: 'lit_protocol' - }); - - return respondWithTSV(rows, `partners-export_lit_${lastWeek}.tsv`); -} diff --git a/apps/scoutgameadmin/app/api/partners/moxie/route.ts b/apps/scoutgameadmin/app/api/partners/moxie/route.ts deleted file mode 100644 index 142e6012af..0000000000 --- a/apps/scoutgameadmin/app/api/partners/moxie/route.ts +++ /dev/null @@ -1,135 +0,0 @@ -import { prisma } from '@charmverse/core/prisma-client'; -import { currentSeason, getLastWeek } from '@packages/scoutgame/dates'; -import { airstackRequest } from '@packages/scoutgame/moxie/airstackRequest'; -import { getMoxieFanToken } from '@packages/scoutgame/moxie/getMoxieFanToken'; -import { uniq } from 'lodash'; - -import { respondWithTSV } from 'lib/nextjs/respondWithTSV'; - -export const dynamic = 'force-dynamic'; - -type MoxieBonusRow = { - 'Builder FID': number; - 'Builder path': string; - 'Builder event': string; - 'Scout FID': number; - 'Scout email': string; - 'Scout path': string; -}; - -export async function GET() { - const lastWeek = getLastWeek(); - const builders = await prisma.scout.findMany({ - where: { - builderStatus: 'approved' - }, - orderBy: { - farcasterId: 'asc' - }, - select: { - farcasterId: true, - path: true, - events: { - where: { - type: { - in: ['merged_pull_request', 'daily_commit'] - }, - week: lastWeek - } - }, - builderNfts: { - where: { - season: currentSeason - }, - select: { - nftSoldEvents: { - select: { - scout: { - select: { - farcasterId: true, - path: true - } - } - } - } - } - } - } - }); - const rows: MoxieBonusRow[] = []; - - await Promise.all( - builders.map(async (builder) => { - if (builder.farcasterId && builder.events.length > 0) { - // TODO: record moxie fan token data so we dont have to look it up again - const moxieNft = await getMoxieFanToken(builder.farcasterId); - if (moxieNft) { - const scoutFids = builder.builderNfts - .map((nft) => nft.nftSoldEvents.map((e) => e.scout.farcasterId)) - .flat() - .filter(Boolean); - for (const scoutFid of uniq(scoutFids)) { - const fanTokenAmount = await getMoxieFanTokenAmount({ - builderFid: builder.farcasterId, - scoutFid: scoutFid! - }); - const scout = await prisma.scout.findUnique({ - where: { - farcasterId: scoutFid! - } - }); - if (fanTokenAmount && scout) { - // console.log('found scout with fan token', builder.farcasterId, scoutFid, fanTokenAmount); - rows.push({ - 'Scout FID': scoutFid!, - 'Scout email': scout.email || '', - 'Scout path': scout.path!, - 'Builder FID': builder.farcasterId, - 'Builder path': builder.path!, - 'Builder event': - (builder.events[0]!.type === 'merged_pull_request' ? `PR on ` : `Commit on `) + - builder.events[0]!.createdAt.toDateString() - }); - } - } - } - } - }) - ); - - return respondWithTSV(rows, `partners-export_moxie_${lastWeek}.tsv`); -} - -export async function getMoxieFanTokenAmount({ - builderFid, - scoutFid -}: { - builderFid: number; - scoutFid: number; -}): Promise { - const query = ` - query GetPortfolioInfo { - MoxieUserPortfolios( - input: { - filter: { - fid: {_eq: "${scoutFid}"}, - fanTokenSymbol: { - # Fan Token to check, symbol will be based on types: - # - User: fid: - # - Channel: cid: - # - Network: id:farcaster - _eq: "fid:${builderFid}" - } - } - } - ) { - MoxieUserPortfolio { - amount: totalUnlockedAmount - } - } - } - `; - const data = await airstackRequest(query); - // console.log('data', data); - return data.data.MoxieUserPortfolios.MoxieUserPortfolio?.[0]?.amount || 0; -} diff --git a/apps/scoutgameadmin/app/api/partners/op_supersim/route.ts b/apps/scoutgameadmin/app/api/partners/op_supersim/route.ts deleted file mode 100644 index 0306d40759..0000000000 --- a/apps/scoutgameadmin/app/api/partners/op_supersim/route.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { getLastWeek } from '@packages/scoutgame/dates'; - -import { respondWithTSV } from 'lib/nextjs/respondWithTSV'; -import { getBuildersForPartner } from 'lib/partners/getBuildersForPartner'; - -export const dynamic = 'force-dynamic'; - -export async function GET() { - const lastWeek = getLastWeek(); - const rows = await getBuildersForPartner({ - week: lastWeek, - bonusPartner: 'op_supersim' - }); - - return respondWithTSV(rows, `partners-export_supersim_${lastWeek}.tsv`); -} diff --git a/apps/scoutgameadmin/app/api/partners/optimism/route.ts b/apps/scoutgameadmin/app/api/partners/optimism/route.ts deleted file mode 100644 index d52f2a45a3..0000000000 --- a/apps/scoutgameadmin/app/api/partners/optimism/route.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { getLastWeek } from '@packages/scoutgame/dates'; -import { getRankedNewScoutsForPastWeek } from '@packages/scoutgame/scouts/getNewScouts'; - -import { respondWithTSV } from 'lib/nextjs/respondWithTSV'; - -export const dynamic = 'force-dynamic'; - -export async function GET() { - const lastWeek = getLastWeek(); - const scouts = await getRankedNewScoutsForPastWeek({ - week: lastWeek - }); - - const rows = scouts.slice(0, 10).map((scout) => ({ - Path: `https://scoutgame.xyz/u/${scout.path}`, - 'Display Name': scout.displayName, - 'Points Earned': scout.pointsEarned, - Wallet: scout.scoutWallet?.[0]?.address - })); - - return respondWithTSV(rows, `partners-export_optimism_new_scouts_${lastWeek}.tsv`); -} diff --git a/apps/scoutgameadmin/app/api/partners/talent/route.ts b/apps/scoutgameadmin/app/api/partners/talent/route.ts deleted file mode 100644 index e1ebce92d8..0000000000 --- a/apps/scoutgameadmin/app/api/partners/talent/route.ts +++ /dev/null @@ -1,97 +0,0 @@ -import type { Scout } from '@charmverse/core/prisma'; -import { prisma } from '@charmverse/core/prisma-client'; -import { getBuildersLeaderboard } from '@packages/scoutgame/builders/getBuildersLeaderboard'; -import { getLastWeek } from '@packages/scoutgame/dates'; -import { getTalentProfile } from '@packages/scoutgame/talent/getTalentProfile'; - -import { respondWithTSV } from 'lib/nextjs/respondWithTSV'; - -export const dynamic = 'force-dynamic'; - -const minimumTalentScore = 75; - -export async function GET() { - const lastWeek = getLastWeek(); - const topBuilders = await getBuildersLeaderboard({ - week: lastWeek - }); - - const buildersWithTalent: { - wallet: string; - score: number; - rank: number; - builder: Pick; - }[] = []; - - for (const builder of topBuilders) { - const fullBuilder = await prisma.scout.findUniqueOrThrow({ - where: { - id: builder.builder.id - }, - select: { - farcasterId: true, - displayName: true, - path: true, - email: true, - talentProfile: { - select: { - id: true, - score: true, - address: true - } - }, - scoutWallet: { - select: { - address: true - } - } - } - }); - - const { scoutWallet, farcasterId } = fullBuilder; - - if (fullBuilder.talentProfile) { - const talentProfile = fullBuilder.talentProfile; - if (talentProfile.score >= minimumTalentScore) { - buildersWithTalent.push({ - rank: builder.rank, - builder: fullBuilder, - score: talentProfile.score, - wallet: talentProfile.address - }); - } - } else { - const wallets = scoutWallet.map((wallet) => wallet.address); - const talentProfile = await getTalentProfile({ - farcasterId, - wallets, - minimumTalentScore - }); - - if (talentProfile) { - buildersWithTalent.push({ - ...talentProfile, - rank: builder.rank, - builder: fullBuilder, - score: talentProfile.score - }); - } - } - - // grab the first 5 builders with 'talent' - if (buildersWithTalent.length >= 5) { - break; - } - } - - const rows = buildersWithTalent.map(({ builder, rank, wallet, score }) => ({ - 'User Name': builder.displayName, - 'Profile Link': `https://scoutgame.xyz/u/${builder.path}`, - Email: builder.email, - 'Wallet Address': wallet, - 'Scout Game Rank': rank, - 'Talent Score': score - })); - - return respondWithTSV(rows, `partners-export_talent_${lastWeek}.tsv`); -} diff --git a/apps/scoutgameadmin/app/api/repos/export/route.ts b/apps/scoutgameadmin/app/api/repos/export/route.ts deleted file mode 100644 index 2aea7aa9b8..0000000000 --- a/apps/scoutgameadmin/app/api/repos/export/route.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { prisma } from '@charmverse/core/prisma-client'; -import { stringify } from 'csv-stringify/sync'; -import { NextResponse } from 'next/server'; - -const columns = ['id', 'owner', 'name', 'url']; - -export const dynamic = 'force-dynamic'; - -export async function GET() { - const rows = await prisma.githubRepo.findMany(); - const exportString = stringify(rows, { header: true, columns }); - return NextResponse.json(exportString); - // return new Response(exportString, { - // status: 200, - // headers: { - // 'Content-Type': 'text/tsv', - // 'Content-Disposition': 'attachment; filename=github_repos.tsv' - // } - // }); -} diff --git a/apps/scoutgameadmin/app/api/repos/route.ts b/apps/scoutgameadmin/app/api/repos/route.ts deleted file mode 100644 index fd3887f900..0000000000 --- a/apps/scoutgameadmin/app/api/repos/route.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { log } from '@charmverse/core/log'; -import { importReposByUser } from '@packages/scoutgame/importReposByUser'; -import type { NextRequest } from 'next/server'; -import { NextResponse } from 'next/server'; - -import { getRepos } from 'lib/repos/getRepos'; - -export async function GET(request: NextRequest) { - const { searchParams } = new URL(request.url); - const searchString = searchParams.get('searchString'); - const repos = await getRepos({ searchString: searchString || undefined }); - return NextResponse.json(repos); -} - -export async function POST(request: NextRequest) { - const { owner } = await request.json(); - - await importReposByUser(owner); - - return NextResponse.json({ success: true }); -} diff --git a/apps/scoutgameadmin/app/api/users/create-builder/route.ts b/apps/scoutgameadmin/app/api/users/create-builder/route.ts deleted file mode 100644 index d204fd600a..0000000000 --- a/apps/scoutgameadmin/app/api/users/create-builder/route.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { log } from '@charmverse/core/log'; -import type { NextRequest } from 'next/server'; -import { NextResponse } from 'next/server'; - -import { createBuilder } from 'lib/users/createBuilder'; - -export async function POST(request: NextRequest) { - const params = await request.json(); - const newUser = await createBuilder(params); - log.info('Approved new builder', { newUser }); - return NextResponse.json({ success: true }); -} diff --git a/apps/scoutgameadmin/app/api/users/export/route.ts b/apps/scoutgameadmin/app/api/users/export/route.ts deleted file mode 100644 index c9b4ffcbcd..0000000000 --- a/apps/scoutgameadmin/app/api/users/export/route.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { prisma } from '@charmverse/core/prisma-client'; -import { currentSeason } from '@packages/scoutgame/dates'; -import type { NextRequest } from 'next/server'; - -import { respondWithTSV } from 'lib/nextjs/respondWithTSV'; - -export const dynamic = 'force-dynamic'; - -type ScoutWithGithubUser = { - id: string; - path: string; - createdAt: string; - email?: string; - tokenId?: number; - optedInToMarketing?: string; - builderStatus?: string; - githubLogin?: string; - fid?: number; - farcasterName?: string; - currentBalance: number; - nftsPurchased: number; - nftsSold: number; - pointsEarnedAsScout: number; - pointsEarnedAsBuilder: number; - weeklyBuilderRank?: number; -}; - -export async function GET() { - const users = await prisma.scout.findMany({ - select: { - id: true, - path: true, - sendMarketing: true, - createdAt: true, - avatar: true, - email: true, - builderStatus: true, - farcasterId: true, - farcasterName: true, - currentBalance: true, - githubUser: true, - userSeasonStats: true, - userWeeklyStats: true, - builderNfts: { - where: { - season: currentSeason - } - } - } - }); - const rows: ScoutWithGithubUser[] = users.map((user) => ({ - id: user.id, - path: user.path!, - createdAt: user.createdAt.toDateString(), - email: user.email || undefined, - optedInToMarketing: user.sendMarketing ? 'Yes' : '', - // avatar: user.avatar || '', - builderStatus: user.builderStatus || undefined, - tokenId: user.builderNfts[0]?.tokenId || undefined, - fid: user.farcasterId || undefined, - farcasterName: user.farcasterName || undefined, - githubLogin: user.githubUser[0]?.login, - currentBalance: user.currentBalance, - pointsEarnedAsScout: user.userSeasonStats[0]?.pointsEarnedAsScout || 0, - pointsEarnedAsBuilder: user.userSeasonStats[0]?.pointsEarnedAsBuilder || 0, - nftsPurchased: user.userSeasonStats[0]?.nftsPurchased || 0, - nftsSold: user.userSeasonStats[0]?.nftsSold || 0, - weeklyBuilderRank: user.userWeeklyStats[0]?.rank || undefined - })); - - return respondWithTSV(rows, 'scout_users_export.tsv'); -} diff --git a/apps/scoutgameadmin/app/api/users/get-user/route.ts b/apps/scoutgameadmin/app/api/users/get-user/route.ts deleted file mode 100644 index e2fc5884c3..0000000000 --- a/apps/scoutgameadmin/app/api/users/get-user/route.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { NextRequest } from 'next/server'; -import { NextResponse } from 'next/server'; - -import { getUser } from 'lib/users/getUser'; - -export async function GET(request: NextRequest) { - const { searchParams } = new URL(request.url); - const userId = searchParams.get('userId'); - if (!userId) { - return NextResponse.json({ error: 'userId is required' }, { status: 400 }); - } - const user = await getUser(userId); - return NextResponse.json(user); -} diff --git a/apps/scoutgameadmin/app/api/users/route.ts b/apps/scoutgameadmin/app/api/users/route.ts deleted file mode 100644 index c7d1e3a723..0000000000 --- a/apps/scoutgameadmin/app/api/users/route.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { log } from '@charmverse/core/log'; -import type { BuilderStatus } from '@charmverse/core/prisma'; -import type { NextRequest } from 'next/server'; -import { NextResponse } from 'next/server'; - -import { createUser } from 'lib/users/createUser'; -import type { SortOrder, SortField } from 'lib/users/getUsers'; -import { getUsers } from 'lib/users/getUsers'; -import { searchForUser } from 'lib/users/searchForUser'; - -export async function GET(request: NextRequest) { - const { searchParams } = new URL(request.url); - const builderStatus = searchParams.get('builderStatus') as BuilderStatus | undefined; - const searchString = searchParams.get('searchString'); - const sortOrder = searchParams.get('sortOrder') as SortOrder | undefined; - const sortField = searchParams.get('sortField') as SortField | undefined; - const repos = await getUsers({ - searchString: searchString || undefined, - sortOrder, - sortField, - builderStatus - }); - return NextResponse.json(repos); -} - -export async function POST(request: NextRequest) { - const params = await request.json(); - const user = await searchForUser(params); - if (!user) { - throw new Error(`User not found: ${params.searchString}`); - } - const newUser = await createUser(user); - log.info('Created new user', { newUser }); - return NextResponse.json({ success: true }); -} diff --git a/apps/scoutgameadmin/app/api/users/search-for-user/route.ts b/apps/scoutgameadmin/app/api/users/search-for-user/route.ts deleted file mode 100644 index 42a4885f94..0000000000 --- a/apps/scoutgameadmin/app/api/users/search-for-user/route.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { NextRequest } from 'next/server'; -import { NextResponse } from 'next/server'; - -import { searchForUser } from 'lib/users/searchForUser'; - -export async function GET(request: NextRequest) { - const { searchParams } = new URL(request.url); - const searchString = searchParams.get('searchString'); - const user = await searchForUser({ searchString: searchString || '' }); - return NextResponse.json(user); -} diff --git a/apps/scoutgameadmin/app/layout.tsx b/apps/scoutgameadmin/app/layout.tsx deleted file mode 100644 index 3c09a950fe..0000000000 --- a/apps/scoutgameadmin/app/layout.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import type { Metadata, Viewport } from 'next'; -import Script from 'next/script'; -import type { ReactNode } from 'react'; - -import { AppProviders } from 'components/common/AppProviders'; - -import 'theme/styles.scss'; - -const appName = 'Scout Game Admin'; - -export const metadata: Metadata = { - applicationName: appName, - icons: { - icon: ['/favicon.ico'], - apple: ['/favicon.ico'] - }, - title: appName, - formatDetection: { - telephone: false - }, - openGraph: { - type: 'website', - siteName: appName, - images: 'https://scoutgame.xyz/images/manifest/scoutgame-logo-256.png', - title: appName, - description: 'Scout. Build. Win.' - }, - twitter: { - card: 'summary', - title: appName, - description: 'Scout. Build. Win.' - } -}; -export const viewport: Viewport = { - themeColor: '#000', - userScalable: false -}; -export default async function RootLayout({ - children -}: Readonly<{ - children: ReactNode; -}>) { - return ( - - - {/* load env vars for the frontend - note that the parent body tag is required for React to not complain */} -