Email Command Engine (CommandController)
Business perspective: Email Command Engine
1. Business Summary
Parses inbound emails containing custom DSL (CreatePo, CreateRFR, auto_planing, plan_id) and creates corresponding entities.
2. Business Value
Frictionless intake from sales/PMs via email.
3. Users / Stakeholders
PMs, AMs, sales agents.
4. Workflows
mail_submit()ingests payload (subject/body/files).- Parses DSL tokens.
- Creates PO/Job/RFR; logs to
received_requests. - Files attached to job source folders.
5. Sub-Features
- Inline auto-planning toggles.
- Plan-based assignment.
- Attachment handling.
6. Business Rules
- DSL keys must be present and parseable.
- Linked to email parsing templates and data mapping templates.
7. Data Entities
ReceivedRequest, EmailParsingTemplate, data_mapping_templates_languages.
8. Entry Points
command/mail_submit.- Possibly secondary
commandt.
9. Inputs & Outputs
- Inputs: emails (likely SQS-bridged).
- Outputs: PO/Job/RFR records.
10. Integrations
- AWS SES/SQS, ownCloud (file storage).
11. Calculations / Logic
- Parsing & validation per template.
12. Status Lifecycle
- ReceivedRequest queue states.
13. Permissions
- Authenticated by sender mapping or token.
14. Reports & KPIs
- Inbound volume, parse error rate.
15. Risks & Observations
- DSL injection risk if input not sanitized.
- Hardcoded grammar; brittle to format changes.
16. Source Code Evidence
app/Controller/CommandController.php(~7,981 LOC).app/Controller/CommandtController.php(~5,221 LOC).app/Model/ReceivedRequest.php.