2.1 KiB
2.1 KiB
Antares Data Exporter - Operational Guide for Agents
This repository contains a synchronous Rust utility that fetches product data from the Antares B2B API and exports it to Excel. Follow these instructions for successful operation and development.
⚙️ Execution & Setup
- Setup: Always run
cp .env.example .envfirst, then fill credentials in.env. - Build/Run Order: The intended command sequence is:
cargo build --releasefollowed by running the binary (./target/release/antares_get_data). - Development Flow: Use this order when developing or verifying changes:
cargo fmt --all -- --check(Linting)
cargo check(Compile/Verify)
cargo test(Testing)
💻 Architecture & Quirks
- Blocking HTTP: The API client uses
reqwest::blocking::Client. This is intentional; the entire process is synchronous, and a 300-second timeout must be respected. - Credentials: Only use
ANTARES_USERCODEandANTARES_PASSWORDfrom.env. Hardcoding credentials is prohibited. - Artifacts (Persistence): Three key artifacts are generated daily/per run:
antares.json: Raw API response data. Saved at the repo root.out/antares_export.xlsx: Final Excel export. Theout/directory must exist.log/{YYYY-MM-DD}.log: Daily operational logs. Thelog/directory must exist.
📊 Business Logic (Excel Export Rules)
The Excel sheet does not use a simple JSON dump; it implements specific business rules:
- Required Fields: Rows are skipped if the product code (
cikkszam) or product name is missing. - Column Mapping Precedence:
BESZCIKKNEV: Usecikk_megnevezes_rovid, falling back tocikk_megnevezes.EGYSEGAR: Prefernetto_kisker_ar. If zero, check the product description (cikk_jellemzok) for an entry matching"Alap ár".
🗂️ Module Ownership
- Schema Changes: Always update struct definitions in
src/template/antares.rsbefore making changes to data handling logic. - Tooling: New utility functions (e.g., CSV export) should be added as self-contained modules within
src/tools/.