Skip to content

Commit

Permalink
馃 Improve suspendWorkspace script
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jan 8, 2024
1 parent 56e0342 commit 311753f
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/scripts/suspendWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,29 @@ const suspendWorkspace = async () => {
console.log(e.duration, 'ms')
})

const type = (await p.select({
const type = await p.select({
message: 'Select way',
options: [
{ label: 'Typebot public ID', value: 'typebotId' },
{ label: 'Typebot ID', value: 'id' },
{ label: 'Typebot public ID', value: 'publicId' },
{ label: 'Workspace ID', value: 'workspaceId' },
],
})) as 'typebotId' | 'workspaceId'
})

if (!type || typeof type !== 'string') return

const val = (await p.text({
const val = await p.text({
message: 'Enter value',
})) as string
})

if (!val || typeof val !== 'string') return

let workspaceId = type === 'workspaceId' ? val : undefined

if (!workspaceId) {
const typebot = await prisma.typebot.findUnique({
const typebot = await prisma.typebot.findFirst({
where: {
publicId: val,
[type]: val,
},
select: {
workspaceId: true,
Expand Down

0 comments on commit 311753f

Please sign in to comment.