MED-103: create job

This commit is contained in:
Danel Kungla
2025-09-25 15:40:37 +03:00
parent 5dc625c903
commit 2e2498577f
2 changed files with 17 additions and 1 deletions

View File

@@ -38,7 +38,9 @@ function getSpokenLanguages(spokenLanguages?: string) {
} }
export default async function syncConnectedOnline() { export default async function syncConnectedOnline() {
const isProd = process.env.NODE_ENV === 'production'; const isProd = !['test', 'localhost'].some((pathString) =>
process.env.NEXT_PUBLIC_SITE_URL?.includes(pathString),
);
const baseUrl = process.env.CONNECTED_ONLINE_URL; const baseUrl = process.env.CONNECTED_ONLINE_URL;

View File

@@ -0,0 +1,14 @@
select
cron.schedule(
'sync-connected-online-every-night', -- Unique job name
'0 1 * * *', -- Cron schedule: every night at 04:00 (GMT +3)
$$
select
net.http_post(
url := 'https://test.medreport.ee/api/job/sync-connected-online',
headers := jsonb_build_object(
'x-jobs-api-key', 'fd26ec26-70ed-11f0-9e95-431ac3b15a84'
)
) as request_id;
$$
);