🐛 Remove delete result cascade
This commit is contained in:
committed by
Baptiste Arnaud
parent
30dff2d5d7
commit
3c803b1345
61
apps/builder/assets/logos/StripeClimateLogo.tsx
Normal file
61
apps/builder/assets/logos/StripeClimateLogo.tsx
Normal file
@ -0,0 +1,61 @@
|
||||
import { Icon, IconProps } from '@chakra-ui/react'
|
||||
|
||||
export const StripeClimateLogo = (props: IconProps) => (
|
||||
<Icon
|
||||
width="24px"
|
||||
height="24px"
|
||||
viewBox="0 0 32 32"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
{...props}
|
||||
>
|
||||
<linearGradient
|
||||
id="StripeClimate-gradient-a"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="16"
|
||||
y1="20.6293"
|
||||
x2="16"
|
||||
y2="7.8394"
|
||||
gradientTransform="matrix(1 0 0 -1 0 34)"
|
||||
>
|
||||
<stop offset="0" stop-color="#00d924" />
|
||||
<stop offset="1" stop-color="#00cb1b" />
|
||||
</linearGradient>
|
||||
<path
|
||||
d="M0 10.82h32c0 8.84-7.16 16-16 16s-16-7.16-16-16z"
|
||||
fill="url(#StripeClimate-gradient-a)"
|
||||
/>
|
||||
<linearGradient
|
||||
id="StripeClimate-gradient-b"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="24"
|
||||
y1="28.6289"
|
||||
x2="24"
|
||||
y2="17.2443"
|
||||
gradientTransform="matrix(1 0 0 -1 0 34)"
|
||||
>
|
||||
<stop offset=".1562" stop-color="#009c00" />
|
||||
<stop offset="1" stop-color="#00be20" />
|
||||
</linearGradient>
|
||||
<path
|
||||
d="M32 10.82c0 2.21-1.49 4.65-5.41 4.65-3.42 0-7.27-2.37-10.59-4.65 3.52-2.43 7.39-5.63 10.59-5.63C29.86 5.18 32 8.17 32 10.82z"
|
||||
fill="url(#StripeClimate-gradient-b)"
|
||||
/>
|
||||
<linearGradient
|
||||
id="StripeClimate-gradient-c"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="8"
|
||||
y1="16.7494"
|
||||
x2="8"
|
||||
y2="29.1239"
|
||||
gradientTransform="matrix(1 0 0 -1 0 34)"
|
||||
>
|
||||
<stop offset="0" stop-color="#ffe37d" />
|
||||
<stop offset="1" stop-color="#ffc900" />
|
||||
</linearGradient>
|
||||
<path
|
||||
d="M0 10.82c0 2.21 1.49 4.65 5.41 4.65 3.42 0 7.27-2.37 10.59-4.65-3.52-2.43-7.39-5.64-10.59-5.64C2.14 5.18 0 8.17 0 10.82z"
|
||||
fill="url(#StripeClimate-gradient-c)"
|
||||
/>
|
||||
</Icon>
|
||||
)
|
@ -1,4 +1,5 @@
|
||||
import { Stack, HStack, Text } from '@chakra-ui/react'
|
||||
import { StripeClimateLogo } from 'assets/logos/StripeClimateLogo'
|
||||
import { NextChakraLink } from 'components/nextChakra/NextChakraLink'
|
||||
import { useUser } from 'contexts/UserContext'
|
||||
import { useWorkspace } from 'contexts/WorkspaceContext'
|
||||
@ -63,7 +64,21 @@ export const ChangePlanForm = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<Stack spacing={4}>
|
||||
<Stack spacing={6}>
|
||||
<HStack maxW="500px">
|
||||
<StripeClimateLogo />
|
||||
<Text fontSize="xs" color="gray.500">
|
||||
Typebot is contributing 1% of your subscription to remove CO₂ from the
|
||||
atmosphere.{' '}
|
||||
<NextChakraLink
|
||||
href="https://climate.stripe.com/5VCRAq"
|
||||
isExternal
|
||||
textDecor="underline"
|
||||
>
|
||||
More info.
|
||||
</NextChakraLink>
|
||||
</Text>
|
||||
</HStack>
|
||||
<HStack alignItems="stretch" spacing="4" w="full">
|
||||
<StarterPlanContent
|
||||
initialChatsLimitIndex={
|
||||
@ -94,9 +109,8 @@ export const ChangePlanForm = () => {
|
||||
isExternal
|
||||
textDecor="underline"
|
||||
>
|
||||
Let me know
|
||||
Let's chat!
|
||||
</NextChakraLink>
|
||||
.
|
||||
</Text>
|
||||
</Stack>
|
||||
)
|
||||
|
@ -38,6 +38,10 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const typebots = await prisma.typebot.deleteMany({
|
||||
where: canWriteTypebot(typebotId, user),
|
||||
})
|
||||
await prisma.result.updateMany({
|
||||
where: { typebot: canWriteTypebot(typebotId, user) },
|
||||
data: { isArchived: true },
|
||||
})
|
||||
return res.send({ typebots })
|
||||
}
|
||||
if (req.method === 'PUT') {
|
||||
|
@ -30,6 +30,17 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
members: { some: { userId: user.id, role: WorkspaceRole.ADMIN } },
|
||||
},
|
||||
})
|
||||
await prisma.result.updateMany({
|
||||
where: {
|
||||
typebot: {
|
||||
workspace: {
|
||||
id,
|
||||
members: { some: { userId: user.id, role: WorkspaceRole.ADMIN } },
|
||||
},
|
||||
},
|
||||
},
|
||||
data: { isArchived: true },
|
||||
})
|
||||
return res.status(200).json({
|
||||
message: 'success',
|
||||
})
|
||||
|
Reference in New Issue
Block a user