manifold/functions/src/test-scheduled-function.ts
2022-09-23 09:31:52 -04:00

17 lines
483 B
TypeScript

import { APIError, newEndpoint } from './api'
import { sendPortfolioUpdateEmailsToAllUsers } from './weekly-profit-loss-emails'
import { isProd } from './utils'
export const testscheduledfunction = newEndpoint(
{ method: 'GET', memory: '4GiB' },
async (_req) => {
// Replace your function here
if (isProd())
throw new APIError(400, 'This function is only available in dev mode')
await sendPortfolioUpdateEmailsToAllUsers()
return { success: true }
}
)