mirror of
https://github.com/siv-org/siv.git
synced 2026-05-03 03:00:59 -04:00
Delete empty mailgun-opens
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// This script will populate the supabase.mailgun-opens table's `message-id` column.
|
||||
// This script will populate the supabase.mailgun-opens table's `messageId` column.
|
||||
|
||||
import { supabase } from 'api/_supabase'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
@@ -13,7 +13,6 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
.select('*', { count: 'exact' })
|
||||
.order('id', { ascending: false })
|
||||
.is('messageId', null)
|
||||
// .like('from', '%<%')
|
||||
// .range(6000, 7000)
|
||||
.limit(1000)
|
||||
|
||||
@@ -22,7 +21,11 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
await Promise.all(
|
||||
(opens || []).map(async ({ id, json }) => {
|
||||
const eventData = json['event-data']
|
||||
if (!eventData) return `${id}: No event-data`
|
||||
if (!eventData) {
|
||||
// await supabase.from('mailgun-opens').delete().eq('id', id)
|
||||
// return `${id}: deleted`
|
||||
return `${id}: no event-data`
|
||||
}
|
||||
|
||||
const messageId = eventData.message.headers['message-id']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user