Skip to content

Commit

Permalink
🛂 Reset isQuarantined on the first of month
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Apr 23, 2023
1 parent c6983c9 commit 3fbd044
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 239 deletions.
5 changes: 4 additions & 1 deletion packages/emails/src/emails/AlmostReachedChatsLimitEmail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { SendMailOptions } from 'nodemailer'
import { sendEmail } from '../sendEmail'

type AlmostReachedChatsLimitEmailProps = {
usagePercent: number
chatsLimit: number
url: string
}
Expand All @@ -26,6 +27,7 @@ const readableResetDate = firstDayOfNextMonth
.join(' ')

export const AlmostReachedChatsLimitEmail = ({
usagePercent,
chatsLimit,
url,
}: AlmostReachedChatsLimitEmailProps) => {
Expand All @@ -45,7 +47,8 @@ export const AlmostReachedChatsLimitEmail = ({
<Text>Your bots are chatting a lot. That&apos;s amazing. 💙</Text>
<Text>
This means you&apos;ve almost reached your monthly chats limit.
You currently reached 80% of {readableChatsLimit} chats.
You currently reached {usagePercent}% of {readableChatsLimit}{' '}
chats.
</Text>
<Text>This limit will be reset on {readableResetDate}.</Text>
<Text fontWeight="800">
Expand Down
65 changes: 0 additions & 65 deletions packages/emails/src/emails/AlmostReachedStorageLimitEmail.tsx

This file was deleted.

64 changes: 0 additions & 64 deletions packages/emails/src/emails/ReachedChatsLimitEmail.tsx

This file was deleted.

63 changes: 0 additions & 63 deletions packages/emails/src/emails/ReachedStorageLimitEmail.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions packages/emails/src/emails/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
export * from './AlmostReachedChatsLimitEmail'
export * from './AlmostReachedStorageLimitEmail'
export * from './DefaultBotNotificationEmail'
export * from './GuestInvitationEmail'
export * from './ReachedChatsLimitEmail'
export * from './ReachedStorageLimitEmail'
export * from './WorkspaceMemberInvitationEmail'
export * from './MagicLinkEmail'
31 changes: 1 addition & 30 deletions packages/emails/src/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import fs from 'fs'
import path from 'path'
import {
AlmostReachedChatsLimitEmail,
AlmostReachedStorageLimitEmail,
DefaultBotNotificationEmail,
GuestInvitationEmail,
ReachedChatsLimitEmail,
ReachedStorageLimitEmail,
WorkspaceMemberInvitation,
} from './emails'
import { MagicLinkEmail } from './emails/MagicLinkEmail'
Expand Down Expand Up @@ -47,38 +44,12 @@ const createHtmlFile = () => {
path.resolve(__dirname, 'dist', 'almostReachedChatsLimit.html'),
render(
<AlmostReachedChatsLimitEmail
usagePercent={86}
url={'https://app.typebot.io'}
chatsLimit={2000}
/>
).html
)
fs.writeFileSync(
path.resolve(__dirname, 'dist', 'almostReachedStorageLimit.html'),
render(
<AlmostReachedStorageLimitEmail
url={'https://app.typebot.io'}
storageLimit={4}
/>
).html
)
fs.writeFileSync(
path.resolve(__dirname, 'dist', 'reachedChatsLimit.html'),
render(
<ReachedChatsLimitEmail
url={'https://app.typebot.io'}
chatsLimit={10000}
/>
).html
)
fs.writeFileSync(
path.resolve(__dirname, 'dist', 'reachedStorageLimit.html'),
render(
<ReachedStorageLimitEmail
url={'https://app.typebot.io'}
storageLimit={8}
/>
).html
)
fs.writeFileSync(
path.resolve(__dirname, 'dist', 'defaultBotNotification.html'),
render(
Expand Down
11 changes: 11 additions & 0 deletions packages/scripts/cleanDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const cleanDatabase = async () => {
if (isFirstOfMonth) {
await deleteArchivedResults()
await deleteArchivedTypebots()
await resetQuarantinedWorkspaces()
}
console.log('Done!')
}
Expand Down Expand Up @@ -118,4 +119,14 @@ const deleteExpiredVerificationTokens = async () => {
console.log(`Deleted ${count} expired verifiations tokens.`)
}

const resetQuarantinedWorkspaces = async () =>
prisma.workspace.updateMany({
where: {
isQuarantined: true,
},
data: {
isQuarantined: false,
},
})

cleanDatabase().then()
Loading

1 comment on commit 3fbd044

@vercel
Copy link

@vercel vercel bot commented on 3fbd044 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

facelabko.com
filmylogy.com
goldorayo.com
rabbit.cr8.ai
signup.cr8.ai
start.taxt.co
turkey.cr8.ai
vhpage.cr8.ai
vitamyway.com
am.nigerias.io
an.nigerias.io
app.yvon.earth
ar.nigerias.io
bot.enreso.org
bot.rslabs.pro
bots.bridge.ai
chat.hayuri.id
chat.uprize.hu
chatgpt.lam.ee
chicken.cr8.ai
gollum.riku.ai
gsbulletin.com
journey.cr8.ai
panther.cr7.ai
panther.cr8.ai
pay.sifuim.com
penguin.cr8.ai
talk.gocare.io
test.bot.gives
ticketfute.com
unicorn.cr8.ai
apo.nigerias.io
apr.nigerias.io
aso.nigerias.io
blackcan.cr8.ai
bot.4display.nl
bot.ageenda.com
bot.artiweb.app
bot.devitus.com
bot.jesopizz.it
bot.reeplai.com
bot.scayver.com
bot.tc-mail.com
chat.lalmon.com
chat.sureb4.com
eventhub.com.au
fitness.riku.ai
games.klujo.com
wordsandimagery.com
88584434.therpm.club
92109660.therpm.club
abbonamento.bwell.it
testbot.afterorigin.com
typebot.influencer.love
www.chatgpt-biliran.com
91181264.your-access.one
abg-assistent.m-vogel.de
ai.chromebookstoreph.com
contextone.wpwakanda.com
form.sergiolimajr.com.br
hunterbot.saleshunter.ai
invite.bridesquadapp.com
link.cascadigital.com.br
login.algorithmpress.com
onboarding.growthside.io
reward.onlinebotdemo.xyz
stap.venturemarketing.in
type.opaulovieira.com.br
aibot.angrybranding.co.uk
app.photosbackupin1.click
bot.aidigitalmarketing.kr
bot.amicidisanfaustino.it
bot.arraesecenteno.com.br
bot.blackboxsports.com.br
bot.cabinrentalagency.com
bot.fusionstarreviews.com
boyfriend-breakup.riku.ai
brigadeirosemdrama.com.br
chat.ertcrebateportal.com
chat.thehomebuyersusa.com
chat.thisiscrushhouse.com
forms.hiabhaykulkarni.com
healthandsafetycourses.uk
sellmyharleylouisiana.com
testbot.sharemyreview.net
typebot-viewer.vercel.app
verfica.botmachine.com.br
ap-help.algorithmpress.com
ap-main.algorithmpress.com
bot.adventureconsulting.hu
bot2.fusionstarreviews.com
casestudyemb.wpwakanda.com
chat.atlasoutfittersk9.com
configurator.bouclidom.com
demo.virtuesocialmedia.com
help.atlasoutfittersk9.com
herbalife.barrettamario.it
homepageonly.wpwakanda.com
liveconvert.kandalearn.com
mainmenu1one.wpwakanda.com

Please sign in to comment.