Skip to content

Commit

Permalink
chore: inngest cron to set price higher
Browse files Browse the repository at this point in the history
  • Loading branch information
joelhooks committed Dec 20, 2024
1 parent da3ae8d commit 922ed56
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {inngest} from '@/inngest/inngest.server'
import {prisma} from '@skillrecordings/database'

export const syncConvertkitPurchases = inngest.createFunction(
{id: `check-price-after-promo-ends`, name: `Check Price After Promo Ends`},
{
cron: '0 * * * *',
},
async ({step}) => {
if (new Date() < new Date('2024-12-20T07:59:59Z')) {
return `it's too early to activate the normal price`
}

await step.run('activate normal price', async () => {
await prisma.$transaction([
prisma.price.update({
where: {id: 'tt_price_cm4wah5nc000108l2f9gzatvp'},
data: {
status: 1,
},
}),
prisma.merchantPrice.update({
where: {
id: 'tt_merchant_price_cm4waiz2f000208l269i90hok',
},
data: {
status: 1,
},
}),
prisma.price.update({
where: {id: 'tt_pricecly5zrrsh000108jq70n5fj1y'},
data: {
status: 0,
},
}),
prisma.merchantPrice.update({
where: {
id: 'tt_merchant_price_cly5zqma7000008jqef27dp2s',
},
data: {
status: 0,
},
}),
])
})
},
)

0 comments on commit 922ed56

Please sign in to comment.