meal-order-manager/functions/close_form/handler.py
Adam Moussa d332affd56
Initial commit: meal ordering automation system (#1)
Playwright-based menu scraper for Redefine Meals, self-contained HTML
order form with S3/CloudFront hosting, DynamoDB-backed order submission
via API Gateway, and automated payroll deduction reports via SES.
2026-05-12 18:25:15 -04:00

26 lines
619 B
Python

import json
import os
import boto3
from shared.db import current_week, get_form_status, set_form_status
_lambda = boto3.client("lambda")
def lambda_handler(event, context):
week = event.get("week", current_week())
status = get_form_status(week)
if status == "closed":
return {"status": "already_closed", "week": week}
set_form_status(week, "closed")
_lambda.invoke(
FunctionName=os.environ["AGGREGATE_FUNCTION_ARN"],
InvocationType="Event",
Payload=json.dumps({"week": week}),
)
return {"status": "closed", "week": week, "aggregate_triggered": True}