🚸 (dashboard) Add unpublish menu item in dashboard
Also remove the useless publishedTypebotId field in Typebot Closes #232
This commit is contained in:
@ -108,7 +108,6 @@ test.describe('API', () => {
|
||||
expect(typebots.length).toBeGreaterThanOrEqual(1)
|
||||
expect(typebots.find((typebot) => typebot.id === typebotId)).toMatchObject({
|
||||
id: typebotId,
|
||||
publishedTypebotId: null,
|
||||
name: 'My typebot',
|
||||
})
|
||||
})
|
||||
|
@ -9,9 +9,19 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (!user) return res.status(401).json({ message: 'Not authenticated' })
|
||||
const typebots = await prisma.typebot.findMany({
|
||||
where: { workspace: { members: { some: { userId: user.id } } } },
|
||||
select: { name: true, publishedTypebotId: true, id: true },
|
||||
select: {
|
||||
name: true,
|
||||
publishedTypebot: { select: { id: true } },
|
||||
id: true,
|
||||
},
|
||||
})
|
||||
return res.send({
|
||||
typebots: typebots.map((typebot) => ({
|
||||
id: typebot.id,
|
||||
name: typebot.name,
|
||||
publishedTypebotId: typebot.publishedTypebot?.id,
|
||||
})),
|
||||
})
|
||||
return res.send({ typebots })
|
||||
}
|
||||
return methodNotAllowed(res)
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-05T06:21:16.522Z",
|
||||
"updatedAt": "2022-02-05T06:21:16.522Z",
|
||||
"name": "My typebot",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"groups": [
|
||||
{
|
||||
|
@ -4,7 +4,6 @@
|
||||
"updatedAt": "2022-11-24T09:13:16.782Z",
|
||||
"icon": "👶",
|
||||
"name": "Sub bot",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"groups": [
|
||||
{
|
||||
|
@ -4,7 +4,6 @@
|
||||
"updatedAt": "2022-11-24T09:12:57.036Z",
|
||||
"icon": "🤖",
|
||||
"name": "Complete bot",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"groups": [
|
||||
{
|
||||
|
@ -4,7 +4,6 @@
|
||||
"updatedAt": "2022-06-08T16:19:32.893Z",
|
||||
"icon": null,
|
||||
"name": "My typebot",
|
||||
"publishedTypebotId": "cl45ol3j8000f2e6gcifqf21t",
|
||||
"folderId": null,
|
||||
"groups": [
|
||||
{
|
||||
|
@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-09T16:17:51.321Z",
|
||||
"updatedAt": "2022-03-09T16:19:07.037Z",
|
||||
"name": "My typebot",
|
||||
"publishedTypebotId": "dm12bh6hmEQemywn86osJD",
|
||||
"folderId": null,
|
||||
"groups": [
|
||||
{
|
||||
|
@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-08T15:58:49.720Z",
|
||||
"updatedAt": "2022-03-08T16:07:18.899Z",
|
||||
"name": "My typebot",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"groups": [
|
||||
{
|
||||
|
@ -4,7 +4,6 @@
|
||||
"updatedAt": "2022-12-15T09:17:15.366Z",
|
||||
"icon": null,
|
||||
"name": "Another typebot copy",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"groups": [
|
||||
{
|
||||
|
@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-23T08:41:30.106Z",
|
||||
"updatedAt": "2022-03-23T08:41:30.106Z",
|
||||
"name": "My typebot",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"groups": [
|
||||
{
|
||||
|
@ -4,7 +4,6 @@
|
||||
"updatedAt": "2022-12-14T14:48:19.086Z",
|
||||
"icon": null,
|
||||
"name": "My typebot copy",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"groups": [
|
||||
{
|
||||
|
@ -4,7 +4,6 @@
|
||||
"updatedAt": "2022-10-21T16:30:57.642Z",
|
||||
"icon": null,
|
||||
"name": "My typebot",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"groups": [
|
||||
{
|
||||
|
Reference in New Issue
Block a user