Skip to content

Commit

Permalink
adding name
Browse files Browse the repository at this point in the history
  • Loading branch information
david-loe committed Oct 22, 2024
1 parent 8cdb1ba commit dd34daf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ cp config.yaml.example config.yaml
- `mapping`
- `db_type`
- `db_name`
- Optional: `name` (für logs)
- Optional: `key_fields` (für Updates)
- Optional: `create_new` (wenn `true` werden neue Dokumente bei Frappe erstellt, für die kein match anhand der `key_fields` gefunden wurde)
- Optional: `process_all` (`true` wenn alle gefundenen Dokumente verarbeitet werden sollen, andernfalls nur das erste)
Expand All @@ -41,6 +42,7 @@ cp config.yaml.example config.yaml
- `mapping`
- `db_type`
- `db_name`
- Optional: `name` (für logs)
- Optional: `key_fields` (für Updates)
- Optional: `create_new` (wenn `true` werden neue Dokumente in der Datenbank eingefügt, für die kein match anhand der `key_fields` gefunden wurde)

Expand Down
3 changes: 3 additions & 0 deletions sync_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(
frappe_api: FrappeAPI,
dry_run: bool,
):
self.name = task_config.get("name")
self.endpoint = task_config.get("endpoint")
self.mapping = task_config.get("mapping")
self.db_type = task_config.get("db_type")
Expand Down Expand Up @@ -67,6 +68,8 @@ def _check_config(self, task_config: Dict[str, str | bool | list | Dict[str, str
self.key_fields = []

def execute(self):
if self.name:
logging.info(f"Starte Ausführung von '{self.name}'.")
if self.direction == "db_to_frappe":
self.sync_db_to_frappe()
elif self.direction == "frappe_to_db":
Expand Down

0 comments on commit dd34daf

Please sign in to comment.