diff --git a/projekt-matching/deploy/projekt-matching.service b/projekt-matching/deploy/projekt-matching.service new file mode 100644 index 0000000..9c22b95 --- /dev/null +++ b/projekt-matching/deploy/projekt-matching.service @@ -0,0 +1,6 @@ +[Unit] +Description=Trigger PM Ingest Langflow webhook + +[Service] +Type=oneshot +ExecStart=%h/bin/projekt-matching/deploy/trigger_webhook.sh diff --git a/projekt-matching/deploy/projekt-matching.timer b/projekt-matching/deploy/projekt-matching.timer new file mode 100644 index 0000000..ed45207 --- /dev/null +++ b/projekt-matching/deploy/projekt-matching.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Poll chancen@ inbox via PM Ingest every 5 minutes + +[Timer] +OnCalendar=*:00/5 +Persistent=false + +[Install] +WantedBy=timers.target diff --git a/projekt-matching/deploy/trigger_webhook.sh b/projekt-matching/deploy/trigger_webhook.sh new file mode 100755 index 0000000..e819b6a --- /dev/null +++ b/projekt-matching/deploy/trigger_webhook.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Fire the PM Ingest webhook. Carries no logic; failures are harmless +# (state lives in the IMAP inbox, next tick retries). +set -u +source "$HOME/.config/projekt-matching/env" +curl -sS -m 15 -X POST "$FLOW1_WEBHOOK" \ + -H "x-api-key: $LANGFLOW_API_KEY" -H 'Content-Type: application/json' \ + -d '{"source": "systemd-timer"}' || true +echo diff --git a/projekt-matching/tests/e2e/flag_inbox.py b/projekt-matching/tests/e2e/flag_inbox.py new file mode 100644 index 0000000..d5ccda3 --- /dev/null +++ b/projekt-matching/tests/e2e/flag_inbox.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +import os +import sys + +sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) +from projektmatch import mailer # noqa: E402 + +box = mailer.MailBox("chancen@destengs.com", os.environ["PM_IMAP_PASSWORD"]) +uids = box.unchecked_uids() +for uid in uids: + box.flag_checked(uid) +print(f"flagged {len(uids)} mails as checked") +box.close()