mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-06 12:57:48 +00:00
change hubspot endpoint to grwoth server
This commit is contained in:
122
.github/workflows/production.yml
vendored
122
.github/workflows/production.yml
vendored
@@ -1,75 +1,73 @@
|
|||||||
name: Production deployment
|
name: Production deployment
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
STACK_FILE: docker/production.yml
|
STACK_FILE: docker/production.yml
|
||||||
REPOSITORY: website
|
REPOSITORY: website
|
||||||
REGISTRY_USERNAME: christyjacob4
|
REGISTRY_USERNAME: christyjacob4
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the repo
|
- name: Checkout the repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: ghcr.io/appwrite/website:${{ env.TAG }}
|
tags: ghcr.io/appwrite/website:${{ env.TAG }}
|
||||||
build-args: |
|
build-args: |
|
||||||
"PUBLIC_APPWRITE_PROJECT_ID=${{ vars.PUBLIC_APPWRITE_PROJECT_ID }}"
|
"PUBLIC_APPWRITE_PROJECT_ID=${{ vars.PUBLIC_APPWRITE_PROJECT_ID }}"
|
||||||
"PUBLIC_APPWRITE_DB_MAIN_ID=${{ vars.PUBLIC_APPWRITE_DB_MAIN_ID }}"
|
"PUBLIC_APPWRITE_DB_MAIN_ID=${{ vars.PUBLIC_APPWRITE_DB_MAIN_ID }}"
|
||||||
"PUBLIC_APPWRITE_COL_THREADS_ID=${{ vars.PUBLIC_APPWRITE_COL_THREADS_ID }}"
|
"PUBLIC_APPWRITE_COL_THREADS_ID=${{ vars.PUBLIC_APPWRITE_COL_THREADS_ID }}"
|
||||||
"PUBLIC_APPWRITE_COL_MESSAGES_ID=${{ vars.PUBLIC_APPWRITE_COL_MESSAGES_ID }}"
|
"PUBLIC_APPWRITE_COL_MESSAGES_ID=${{ vars.PUBLIC_APPWRITE_COL_MESSAGES_ID }}"
|
||||||
"PUBLIC_APPWRITE_FN_TLDR_ID=${{ vars.PUBLIC_APPWRITE_FN_TLDR_ID }}"
|
"PUBLIC_APPWRITE_FN_TLDR_ID=${{ vars.PUBLIC_APPWRITE_FN_TLDR_ID }}"
|
||||||
"PUBLIC_APPWRITE_PROJECT_INIT_ID=${{ vars.PUBLIC_APPWRITE_PROJECT_INIT_ID }}"
|
"PUBLIC_APPWRITE_PROJECT_INIT_ID=${{ vars.PUBLIC_APPWRITE_PROJECT_INIT_ID }}"
|
||||||
"APPWRITE_DB_INIT_ID=${{ secrets.APPWRITE_DB_INIT_ID }}"
|
"APPWRITE_DB_INIT_ID=${{ secrets.APPWRITE_DB_INIT_ID }}"
|
||||||
"APPWRITE_COL_INIT_ID=${{ secrets.APPWRITE_COL_INIT_ID }}"
|
"APPWRITE_COL_INIT_ID=${{ secrets.APPWRITE_COL_INIT_ID }}"
|
||||||
"HUBSPOT_INIT_TOKEN=${{ secrets.HUBSPOT_INIT_TOKEN }}"
|
|
||||||
"HUBSPOT_LIST_ID=${{ secrets.HUBSPOT_LIST_ID }}"
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Execute SSH commands
|
- name: Execute SSH commands
|
||||||
uses: appleboy/ssh-action@master
|
uses: appleboy/ssh-action@master
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.PRD_SSH_HOST }}
|
host: ${{ secrets.PRD_SSH_HOST }}
|
||||||
username: ${{ secrets.PRD_SSH_USERNAME }}
|
username: ${{ secrets.PRD_SSH_USERNAME }}
|
||||||
key: ${{ secrets.PRD_SSH_KEY }}
|
key: ${{ secrets.PRD_SSH_KEY }}
|
||||||
script: |
|
script: |
|
||||||
url="https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/appwrite/${{ env.REPOSITORY }}.git"
|
url="https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/appwrite/${{ env.REPOSITORY }}.git"
|
||||||
if ! git clone "${url}" "${{ env.REPOSITORY }}" 2>/dev/null && [ -d "${{ env.REPOSITORY }}" ] ; then
|
if ! git clone "${url}" "${{ env.REPOSITORY }}" 2>/dev/null && [ -d "${{ env.REPOSITORY }}" ] ; then
|
||||||
echo "Clone failed because the folder ${{ env.REPOSITORY }} exists"
|
echo "Clone failed because the folder ${{ env.REPOSITORY }} exists"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ${{ env.REPOSITORY }}
|
cd ${{ env.REPOSITORY }}
|
||||||
git reset --hard HEAD
|
git reset --hard HEAD
|
||||||
git remote set-url origin $url
|
git remote set-url origin $url
|
||||||
git fetch origin
|
git fetch origin
|
||||||
git checkout ${{ env.TAG }}
|
git checkout ${{ env.TAG }}
|
||||||
|
|
||||||
rm -f .env
|
rm -f .env
|
||||||
echo "_APP_VERSION=${{ env.TAG }}" >> .env
|
echo "_APP_VERSION=${{ env.TAG }}" >> .env
|
||||||
echo "_APP_DOMAIN=${{ secrets.PRD_APP_DOMAIN }}" >> .env
|
echo "_APP_DOMAIN=${{ secrets.PRD_APP_DOMAIN }}" >> .env
|
||||||
echo "_APP_SYSTEM_SECURITY_EMAIL_ADDRESS=${{ secrets.APP_SYSTEM_SECURITY_EMAIL_ADDRESS }}" >> .env
|
echo "_APP_SYSTEM_SECURITY_EMAIL_ADDRESS=${{ secrets.APP_SYSTEM_SECURITY_EMAIL_ADDRESS }}" >> .env
|
||||||
echo "SEMATEXT_TOKEN=${{ secrets.SEMATEXT_TOKEN }}" >> .env
|
echo "SEMATEXT_TOKEN=${{ secrets.SEMATEXT_TOKEN }}" >> .env
|
||||||
|
|
||||||
echo ${{ secrets.GH_REGISTRY_TOKEN }} | docker login ghcr.io --username ${{ env.REGISTRY_USERNAME }} --password-stdin
|
echo ${{ secrets.GH_REGISTRY_TOKEN }} | docker login ghcr.io --username ${{ env.REGISTRY_USERNAME }} --password-stdin
|
||||||
docker-compose -f ${{ env.STACK_FILE }} config
|
docker-compose -f ${{ env.STACK_FILE }} config
|
||||||
env $(cat .env | xargs) docker stack deploy --prune --resolve-image always --with-registry-auth -c ${{ env.STACK_FILE }} ${{ env.REPOSITORY }}
|
env $(cat .env | xargs) docker stack deploy --prune --resolve-image always --with-registry-auth -c ${{ env.STACK_FILE }} ${{ env.REPOSITORY }}
|
||||||
|
|||||||
124
.github/workflows/staging.yml
vendored
124
.github/workflows/staging.yml
vendored
@@ -1,76 +1,74 @@
|
|||||||
name: Staging deployment
|
name: Staging deployment
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TAG: ${{ github.sha }}
|
TAG: ${{ github.sha }}
|
||||||
STACK_FILE: docker/stage.yml
|
STACK_FILE: docker/stage.yml
|
||||||
REPOSITORY: website
|
REPOSITORY: website
|
||||||
REGISTRY_USERNAME: christyjacob4
|
REGISTRY_USERNAME: christyjacob4
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the repo
|
- name: Checkout the repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: ghcr.io/appwrite/website:${{ env.TAG }}
|
tags: ghcr.io/appwrite/website:${{ env.TAG }}
|
||||||
build-args: |
|
build-args: |
|
||||||
"PUBLIC_APPWRITE_PROJECT_ID=${{ vars.PUBLIC_APPWRITE_PROJECT_ID }}"
|
"PUBLIC_APPWRITE_PROJECT_ID=${{ vars.PUBLIC_APPWRITE_PROJECT_ID }}"
|
||||||
"PUBLIC_APPWRITE_DB_MAIN_ID=${{ vars.PUBLIC_APPWRITE_DB_MAIN_ID }}"
|
"PUBLIC_APPWRITE_DB_MAIN_ID=${{ vars.PUBLIC_APPWRITE_DB_MAIN_ID }}"
|
||||||
"PUBLIC_APPWRITE_COL_THREADS_ID=${{ vars.PUBLIC_APPWRITE_COL_THREADS_ID }}"
|
"PUBLIC_APPWRITE_COL_THREADS_ID=${{ vars.PUBLIC_APPWRITE_COL_THREADS_ID }}"
|
||||||
"PUBLIC_APPWRITE_COL_MESSAGES_ID=${{ vars.PUBLIC_APPWRITE_COL_MESSAGES_ID }}"
|
"PUBLIC_APPWRITE_COL_MESSAGES_ID=${{ vars.PUBLIC_APPWRITE_COL_MESSAGES_ID }}"
|
||||||
"PUBLIC_APPWRITE_FN_TLDR_ID=${{ vars.PUBLIC_APPWRITE_FN_TLDR_ID }}"
|
"PUBLIC_APPWRITE_FN_TLDR_ID=${{ vars.PUBLIC_APPWRITE_FN_TLDR_ID }}"
|
||||||
"PUBLIC_APPWRITE_PROJECT_INIT_ID=${{ vars.PUBLIC_APPWRITE_PROJECT_INIT_ID }}"
|
"PUBLIC_APPWRITE_PROJECT_INIT_ID=${{ vars.PUBLIC_APPWRITE_PROJECT_INIT_ID }}"
|
||||||
"APPWRITE_DB_INIT_ID=${{ secrets.APPWRITE_DB_INIT_ID }}"
|
"APPWRITE_DB_INIT_ID=${{ secrets.APPWRITE_DB_INIT_ID }}"
|
||||||
"APPWRITE_COL_INIT_ID=${{ secrets.APPWRITE_COL_INIT_ID }}"
|
"APPWRITE_COL_INIT_ID=${{ secrets.APPWRITE_COL_INIT_ID }}"
|
||||||
"HUBSPOT_INIT_TOKEN=${{ secrets.HUBSPOT_INIT_TOKEN }}"
|
|
||||||
"HUBSPOT_LIST_ID=${{ secrets.HUBSPOT_LIST_ID }}"
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Execute SSH commands
|
- name: Execute SSH commands
|
||||||
uses: appleboy/ssh-action@master
|
uses: appleboy/ssh-action@master
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.STG_SSH_HOST }}
|
host: ${{ secrets.STG_SSH_HOST }}
|
||||||
username: ${{ secrets.STG_SSH_USERNAME }}
|
username: ${{ secrets.STG_SSH_USERNAME }}
|
||||||
key: ${{ secrets.STG_SSH_KEY }}
|
key: ${{ secrets.STG_SSH_KEY }}
|
||||||
script: |
|
script: |
|
||||||
url="https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/appwrite/${{ env.REPOSITORY }}.git"
|
url="https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/appwrite/${{ env.REPOSITORY }}.git"
|
||||||
if ! git clone "${url}" "${{ env.REPOSITORY }}" 2>/dev/null && [ -d "${{ env.REPOSITORY }}" ] ; then
|
if ! git clone "${url}" "${{ env.REPOSITORY }}" 2>/dev/null && [ -d "${{ env.REPOSITORY }}" ] ; then
|
||||||
echo "Clone failed because the folder ${{ env.REPOSITORY }} exists"
|
echo "Clone failed because the folder ${{ env.REPOSITORY }} exists"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ${{ env.REPOSITORY }}
|
cd ${{ env.REPOSITORY }}
|
||||||
git reset --hard HEAD
|
git reset --hard HEAD
|
||||||
git remote set-url origin $url
|
git remote set-url origin $url
|
||||||
git fetch origin
|
git fetch origin
|
||||||
git checkout ${{ env.TAG }}
|
git checkout ${{ env.TAG }}
|
||||||
|
|
||||||
rm -f .env
|
rm -f .env
|
||||||
echo "_APP_VERSION=${{ env.TAG }}" >> .env
|
echo "_APP_VERSION=${{ env.TAG }}" >> .env
|
||||||
echo "_APP_DOMAIN=${{ secrets.STG_APP_DOMAIN }}" >> .env
|
echo "_APP_DOMAIN=${{ secrets.STG_APP_DOMAIN }}" >> .env
|
||||||
echo "_APP_SYSTEM_SECURITY_EMAIL_ADDRESS=${{ secrets.APP_SYSTEM_SECURITY_EMAIL_ADDRESS }}" >> .env
|
echo "_APP_SYSTEM_SECURITY_EMAIL_ADDRESS=${{ secrets.APP_SYSTEM_SECURITY_EMAIL_ADDRESS }}" >> .env
|
||||||
echo "SEMATEXT_TOKEN=${{ secrets.SEMATEXT_TOKEN }}" >> .env
|
echo "SEMATEXT_TOKEN=${{ secrets.SEMATEXT_TOKEN }}" >> .env
|
||||||
|
|
||||||
echo ${{ secrets.GH_REGISTRY_TOKEN }} | docker login ghcr.io --username ${{ env.REGISTRY_USERNAME }} --password-stdin
|
echo ${{ secrets.GH_REGISTRY_TOKEN }} | docker login ghcr.io --username ${{ env.REGISTRY_USERNAME }} --password-stdin
|
||||||
docker-compose -f ${{ env.STACK_FILE }} config
|
docker-compose -f ${{ env.STACK_FILE }} config
|
||||||
env $(cat .env | xargs) docker stack deploy --prune --resolve-image always --with-registry-auth -c ${{ env.STACK_FILE }} ${{ env.REPOSITORY }}
|
env $(cat .env | xargs) docker stack deploy --prune --resolve-image always --with-registry-auth -c ${{ env.STACK_FILE }} ${{ env.REPOSITORY }}
|
||||||
|
|||||||
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@@ -45,6 +45,4 @@ jobs:
|
|||||||
PUBLIC_APPWRITE_PROJECT_INIT_ID: ${{ secrets.PUBLIC_APPWRITE_PROJECT_INIT_ID }}
|
PUBLIC_APPWRITE_PROJECT_INIT_ID: ${{ secrets.PUBLIC_APPWRITE_PROJECT_INIT_ID }}
|
||||||
APPWRITE_DB_INIT_ID: ${{ secrets.APPWRITE_DB_INIT_ID }}
|
APPWRITE_DB_INIT_ID: ${{ secrets.APPWRITE_DB_INIT_ID }}
|
||||||
APPWRITE_COL_INIT_ID: ${{ secrets.APPWRITE_COL_INIT_ID }}
|
APPWRITE_COL_INIT_ID: ${{ secrets.APPWRITE_COL_INIT_ID }}
|
||||||
HUBSPOT_INIT_TOKEN: ${{ secrets.HUBSPOT_INIT_TOKEN }}
|
|
||||||
HUBSPOT_LIST_ID: ${{ secrets.HUBSPOT_LIST_ID }}
|
|
||||||
run: pnpm run build
|
run: pnpm run build
|
||||||
|
|||||||
@@ -25,11 +25,7 @@ ENV APPWRITE_DB_INIT_ID ${APPWRITE_DB_INIT_ID}
|
|||||||
ARG APPWRITE_COL_INIT_ID
|
ARG APPWRITE_COL_INIT_ID
|
||||||
ENV APPWRITE_COL_INIT_ID ${APPWRITE_COL_INIT_ID}
|
ENV APPWRITE_COL_INIT_ID ${APPWRITE_COL_INIT_ID}
|
||||||
|
|
||||||
ARG HUBSPOT_INIT_TOKEN
|
|
||||||
ENV HUBSPOT_INIT_TOKEN ${HUBSPOT_INIT_TOKEN}
|
|
||||||
|
|
||||||
ARG HUBSPOT_LIST_ID
|
|
||||||
ENV HUBSPOT_LIST_ID ${HUBSPOT_LIST_ID}
|
|
||||||
|
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import { HUBSPOT_INIT_TOKEN } from '$env/static/private';
|
|
||||||
|
|
||||||
export const hubspot = {
|
|
||||||
fetch: async (path: string, options?: RequestInit) => {
|
|
||||||
return fetch(`https://api.hubapi.com/crm/v3/${path}`, {
|
|
||||||
headers: {
|
|
||||||
Authorization: `Bearer ${HUBSPOT_INIT_TOKEN}`,
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
...options?.headers
|
|
||||||
},
|
|
||||||
...options
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,23 +1,9 @@
|
|||||||
import { APPWRITE_COL_INIT_ID, APPWRITE_DB_INIT_ID, HUBSPOT_LIST_ID } from '$env/static/private';
|
import { APPWRITE_COL_INIT_ID, APPWRITE_DB_INIT_ID } from '$env/static/private';
|
||||||
import { appwriteInit } from '$lib/appwrite/init.js';
|
import { appwriteInit } from '$lib/appwrite/init.js';
|
||||||
|
import { isProUser } from '$lib/utils/console.js';
|
||||||
import type { User } from '$routes/init/helpers.js';
|
import type { User } from '$routes/init/helpers.js';
|
||||||
import { ID, Query } from '@appwrite.io/console';
|
import { ID, Query } from '@appwrite.io/console';
|
||||||
import type { TicketData, TicketDoc } from '../constants.js';
|
import type { TicketData, TicketDoc } from '../constants.js';
|
||||||
import { hubspot } from '$lib/hubspot.server.js';
|
|
||||||
import { isProUser } from '$lib/utils/console.js';
|
|
||||||
|
|
||||||
type Contact = {
|
|
||||||
id: string;
|
|
||||||
properties: {
|
|
||||||
email: string;
|
|
||||||
hs_object_id: '4831113';
|
|
||||||
lastmodifieddate: '2024-01-24T09:16:04.042Z';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
type ContactResults = {
|
|
||||||
results: Array<Contact>;
|
|
||||||
};
|
|
||||||
|
|
||||||
type SendToHubspotArgs = {
|
type SendToHubspotArgs = {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -25,43 +11,16 @@ type SendToHubspotArgs = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function sendToHubspot({ name, email }: SendToHubspotArgs) {
|
async function sendToHubspot({ name, email }: SendToHubspotArgs) {
|
||||||
// See if contact exists
|
await fetch('https://growth.appwrite.io/v1/mailinglists/init', {
|
||||||
const contacts: ContactResults = await hubspot
|
method: 'POST',
|
||||||
.fetch('objects/contacts/batch/read', {
|
headers: {
|
||||||
method: 'POST',
|
'Content-Type': 'application/json'
|
||||||
body: JSON.stringify({
|
},
|
||||||
properties: ['email'],
|
body: JSON.stringify({
|
||||||
idProperty: 'email',
|
email,
|
||||||
inputs: [
|
name
|
||||||
{
|
|
||||||
id: email
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.then((res) => res.json());
|
});
|
||||||
let contact = contacts.results?.[0];
|
|
||||||
|
|
||||||
if (!contact) {
|
|
||||||
contact = await hubspot
|
|
||||||
.fetch('objects/contacts', {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({
|
|
||||||
properties: {
|
|
||||||
email: email,
|
|
||||||
firstname: name
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.then((res) => res.json());
|
|
||||||
}
|
|
||||||
|
|
||||||
await hubspot
|
|
||||||
.fetch(`lists/${HUBSPOT_LIST_ID}/memberships/add`, {
|
|
||||||
method: 'PUT',
|
|
||||||
body: JSON.stringify([contact.id])
|
|
||||||
})
|
|
||||||
.then((res) => res.json());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getTicketDocByUser(user: User) {
|
async function getTicketDocByUser(user: User) {
|
||||||
@@ -75,13 +34,13 @@ async function getTicketDocByUser(user: User) {
|
|||||||
const [gh, aw, isPro] = await Promise.all([
|
const [gh, aw, isPro] = await Promise.all([
|
||||||
user.github?.login
|
user.github?.login
|
||||||
? appwriteInit.database.listDocuments(APPWRITE_DB_INIT_ID, APPWRITE_COL_INIT_ID, [
|
? appwriteInit.database.listDocuments(APPWRITE_DB_INIT_ID, APPWRITE_COL_INIT_ID, [
|
||||||
Query.equal('gh_user', user.github.login)
|
Query.equal('gh_user', user.github.login)
|
||||||
])
|
])
|
||||||
: null,
|
: null,
|
||||||
user.appwrite?.$id
|
user.appwrite?.$id
|
||||||
? appwriteInit.database.listDocuments(APPWRITE_DB_INIT_ID, APPWRITE_COL_INIT_ID, [
|
? appwriteInit.database.listDocuments(APPWRITE_DB_INIT_ID, APPWRITE_COL_INIT_ID, [
|
||||||
Query.equal('aw_email', user.appwrite.email)
|
Query.equal('aw_email', user.appwrite.email)
|
||||||
])
|
])
|
||||||
: null,
|
: null,
|
||||||
isProUser()
|
isProUser()
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user