Skip to content

Commit

Permalink
🛂 Add isQuarantined field in workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Apr 23, 2023
1 parent bda34e3 commit 69e1c4f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
18 changes: 7 additions & 11 deletions apps/viewer/src/features/chat/api/sendMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
} from '../helpers'
import { env, isDefined, omit } from '@typebot.io/lib'
import { prefillVariables } from '@/features/variables/prefillVariables'
import { checkChatsUsage } from '@/features/usage/checkChatsUsage'
import { injectVariablesFromExistingResult } from '@/features/variables/injectVariablesFromExistingResult'
import { deepParseVariables } from '@/features/variables/deepParseVariable'
import { parseVariables } from '@/features/variables/parseVariables'
Expand Down Expand Up @@ -246,9 +245,8 @@ const getTypebot = async (
id: true,
plan: true,
additionalChatsIndex: true,
chatsLimitFirstEmailSentAt: true,
chatsLimitSecondEmailSentAt: true,
customChatsLimit: true,
isQuarantined: true,
},
},
},
Expand All @@ -274,19 +272,17 @@ const getTypebot = async (
message: 'Typebot not found',
})

if ('isClosed' in parsedTypebot && parsedTypebot.isClosed)
const isQuarantined =
typebotQuery &&
'typebot' in typebotQuery &&
typebotQuery.typebot.workspace.isQuarantined

if (('isClosed' in parsedTypebot && parsedTypebot.isClosed) || isQuarantined)
throw new TRPCError({
code: 'BAD_REQUEST',
message: 'Typebot is closed',
})

typebotQuery && 'typebot' in typebotQuery
? await checkChatsUsage({
typebotId: parsedTypebot.id,
workspace: typebotQuery.typebot.workspace,
})
: false

return parsedTypebot
}

Expand Down
1 change: 1 addition & 0 deletions packages/prisma/mysql/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ model Workspace {
customChatsLimit Int?
customStorageLimit Int?
customSeatsLimit Int?
isQuarantined Boolean @default(false)
themeTemplates ThemeTemplate[]
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Workspace" ADD COLUMN "isQuarantined" BOOLEAN NOT NULL DEFAULT false;
1 change: 1 addition & 0 deletions packages/prisma/postgresql/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ model Workspace {
customChatsLimit Int?
customStorageLimit Int?
customSeatsLimit Int?
isQuarantined Boolean @default(false)
themeTemplates ThemeTemplate[]
}

Expand Down
1 change: 1 addition & 0 deletions packages/schemas/features/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const workspaceSchema = z.object({
customChatsLimit: z.number().nullable(),
customStorageLimit: z.number().nullable(),
customSeatsLimit: z.number().nullable(),
isQuarantined: z.boolean(),
}) satisfies z.ZodType<WorkspacePrisma>

export type Workspace = z.infer<typeof workspaceSchema>
Expand Down

1 comment on commit 69e1c4f

@vercel
Copy link

@vercel vercel bot commented on 69e1c4f Apr 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2 – ./apps/viewer

sakuranembro.it
typebot.aloe.do
bot.contakit.com
bot.piccinato.co
bot.sv-energy.it
botc.ceox.com.br
clo.closeer.work
cockroach.cr8.ai
faqs.nigerias.io
form.syncwin.com
haymanevents.com
kw.wpwakanda.com
myrentalhost.com
stan.vselise.com
start.taxtree.io
typebot.aloe.bot
voicehelp.cr8.ai
zap.fundviser.in
app.bouclidom.com
app.chatforms.net
bot.hostnation.de
bot.maitempah.com
bot.phuonghub.com
bot.reviewzer.com
bot.rihabilita.it
cares.urlabout.me
chat.gaswadern.de
chat.rojie.online
fmm.wpwakanda.com
footballmeetup.ie
gentleman-shop.fr
k1.kandabrand.com
kp.pedroknoll.com
lb.ticketfute.com
ov1.wpwakanda.com
ov2.wpwakanda.com
ov3.wpwakanda.com
support.triplo.ai
viewer.typebot.io
welcome.triplo.ai
1988.bouclidom.com
andreimayer.com.br
bot.danyservice.it
bot.iconicbrows.it
bot.lucide.contact
bot.megafox.com.br
bot.neferlopez.com
bots.robomotion.io
testbot.afterorigin.com
typebot.influencer.love
www.chatgpt-biliran.com
91181264.your-access.one
abg-assistent.m-vogel.de
newsletter.itshcormeos.com
rsvp.virtuesocialmedia.com
tarian.theiofoundation.org
ted.meujalecobrasil.com.br
type.dericsoncalari.com.br
bot.pinpointinteractive.com
bot.polychromes-project.com
bot.seidinembroseanchetu.it
chat.semanalimpanome.com.br
designguide.techyscouts.com
liveconvert2.kandalearn.com
presente.empresarias.com.mx
register.algorithmpress.com
sell.sellthemotorhome.co.uk
anamnese.odontopavani.com.br
austin.channelautomation.com
bot.marketingplusmindset.com
bot.seidibergamoseanchetu.it
desabafe.sergiolimajr.com.br
download.venturemarketing.in
piazzatorre.barrettamario.it
type.cookieacademyonline.com
upload.atlasoutfittersk9.com
bot.brigadeirosemdrama.com.br
forms.escoladeautomacao.com.br
onboarding.libertydreamcare.ie
type.talitasouzamarques.com.br
agendamento.sergiolimajr.com.br
anamnese.clinicamegasjdr.com.br
bookings.littlepartymonkeys.com
bot.comercializadoraomicron.com
elevateyourmind.groovepages.com
viewer-v2-typebot-io.vercel.app
yourfeedback.comebackreward.com
bot.cabin-rentals-of-georgia.net
gerador.verificadordehospedes.com
personal-trainer.barrettamario.it
preagendamento.sergiolimajr.com.br
studiotecnicoimmobiliaremerelli.it
download.thailandmicespecialist.com
register.thailandmicespecialist.com
bot.studiotecnicoimmobiliaremerelli.it
pesquisa.escolamodacomproposito.com.br
anamnese.clinicaramosodontologia.com.br
chrome-os-inquiry-system.itschromeos.com
viewer-v2-git-main-typebot-io.vercel.app
main-menu-for-itschromeos.itschromeos.com

Please sign in to comment.