2
0

build: 👷 New compose file and entrypoints

This commit is contained in:
Baptiste Arnaud
2022-05-25 08:13:35 -07:00
parent 4a5a92b973
commit 5d786f59cc
44 changed files with 288 additions and 113 deletions

View File

@ -1,4 +1,5 @@
import { CollaborationType, Prisma, User, WorkspaceRole } from 'db'
import { isNotEmpty } from 'utils'
const parseWhereFilter = (
typebotIds: string[] | string,
@ -19,7 +20,7 @@ const parseWhereFilter = (
id: typeof typebotIds === 'string' ? typebotIds : { in: typebotIds },
workspace:
(type === 'read' && user.email === process.env.ADMIN_EMAIL) ||
process.env.NEXT_PUBLIC_E2E_TEST
isNotEmpty(process.env.NEXT_PUBLIC_E2E_TEST)
? undefined
: {
members: {

View File

@ -2,7 +2,7 @@ import { DashboardFolder } from 'db'
import useSWR from 'swr'
import { fetcher } from './utils'
import { stringify } from 'qs'
import { sendRequest } from 'utils'
import { isNotEmpty, sendRequest } from 'utils'
export const useFolders = ({
parentId,
@ -17,7 +17,11 @@ export const useFolders = ({
const { data, error, mutate } = useSWR<{ folders: DashboardFolder[] }, Error>(
workspaceId ? `/api/folders?${params}` : null,
fetcher,
{ dedupingInterval: process.env.NEXT_PUBLIC_E2E_TEST ? 0 : undefined }
{
dedupingInterval: isNotEmpty(process.env.NEXT_PUBLIC_E2E_TEST)
? 0
: undefined,
}
)
if (error) onError(error)
return {

View File

@ -1,6 +1,6 @@
import { User } from 'db'
import { loadStripe } from '@stripe/stripe-js/pure'
import { sendRequest } from 'utils'
import { isEmpty, sendRequest } from 'utils'
type Props = {
user: User
@ -10,7 +10,7 @@ type Props = {
}
export const pay = async ({ user, currency, plan, workspaceId }: Props) => {
if (!process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY)
if (isEmpty(process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY))
throw new Error('NEXT_PUBLIC_STRIPE_PUBLIC_KEY is missing in env')
const stripe = await loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY)
const { data, error } = await sendRequest<{ sessionId: string }>({

View File

@ -1,7 +1,7 @@
import { CollaborationType, Invitation } from 'db'
import { fetcher } from 'services/utils'
import useSWR from 'swr'
import { sendRequest } from 'utils'
import { isNotEmpty, sendRequest } from 'utils'
export const useInvitations = ({
typebotId,
@ -13,7 +13,11 @@ export const useInvitations = ({
const { data, error, mutate } = useSWR<{ invitations: Invitation[] }, Error>(
typebotId ? `/api/typebots/${typebotId}/invitations` : null,
fetcher,
{ dedupingInterval: process.env.NEXT_PUBLIC_E2E_TEST ? 0 : undefined }
{
dedupingInterval: isNotEmpty(process.env.NEXT_PUBLIC_E2E_TEST)
? 0
: undefined,
}
)
if (error) onError(error)
return {

View File

@ -44,6 +44,7 @@ import useSWR from 'swr'
import { fetcher, toKebabCase } from '../utils'
import {
isBubbleStepType,
isNotEmpty,
isWebhookStep,
omit,
stepHasItems,
@ -80,7 +81,9 @@ export const useTypebots = ({
{ typebots: TypebotInDashboard[] },
Error
>(workspaceId ? `/api/typebots?${params}` : null, fetcher, {
dedupingInterval: process.env.NEXT_PUBLIC_E2E_TEST ? 0 : undefined,
dedupingInterval: isNotEmpty(process.env.NEXT_PUBLIC_E2E_TEST)
? 0
: undefined,
})
if (error) onError(error)
return {

View File

@ -1,7 +1,7 @@
import { MemberInWorkspace, WorkspaceInvitation } from 'db'
import { fetcher } from 'services/utils'
import useSWR from 'swr'
import { sendRequest } from 'utils'
import { isEmpty, sendRequest } from 'utils'
export type Member = MemberInWorkspace & {
name: string | null
@ -14,7 +14,7 @@ export const useMembers = ({ workspaceId }: { workspaceId?: string }) => {
{ members: Member[]; invitations: WorkspaceInvitation[] },
Error
>(workspaceId ? `/api/workspaces/${workspaceId}/members` : null, fetcher, {
dedupingInterval: process.env.NEXT_PUBLIC_E2E_TEST ? 0 : undefined,
dedupingInterval: isEmpty(process.env.NEXT_PUBLIC_E2E_TEST) ? undefined : 0,
})
return {
members: data?.members,