👷 Improve monthly clean database script
Archive results that were not properly archived
This commit is contained in:
@@ -6,10 +6,10 @@ import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUs
|
||||
import { Typebot } from '@typebot.io/schemas'
|
||||
import { omit } from '@typebot.io/lib'
|
||||
import { getTypebot } from '@/features/typebot/helpers/getTypebot'
|
||||
import { archiveResults } from '@/features/results/helpers/archiveResults'
|
||||
import { isReadTypebotForbidden } from '@/features/typebot/helpers/isReadTypebotForbidden'
|
||||
import { removeTypebotOldProperties } from '@/features/typebot/helpers/removeTypebotOldProperties'
|
||||
import { roundGroupsCoordinate } from '@/features/typebot/helpers/roundGroupsCoordinate'
|
||||
import { archiveResults } from '@typebot.io/lib/api/helpers/archiveResults'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await getAuthenticatedUser(req, res)
|
||||
@@ -56,7 +56,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
},
|
||||
})) as Pick<Typebot, 'groups'> | null
|
||||
if (!typebot) return res.status(404).send({ typebot: null })
|
||||
const { success } = await archiveResults({
|
||||
const { success } = await archiveResults(prisma)({
|
||||
typebot,
|
||||
resultsFilter: { typebotId },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user